OutOfMemory while recording 4K video to low class SD card

7 views
Skip to first unread message

Eugene B

unread,
12:40 PM (6 hours ago) 12:40 PM
to Android CameraX Discussion Group
When recording 4K video to a low-class (e.g., Class 4) SD card, the video stream continuously fills the internal buffer faster than the data can be written to the slow storage medium. This quickly leads to a system-level low memory condition. To maintain overall OS functionality, Android's process management then terminates all background and, eventually, foreground processes, including the camera app.

The SD card specification does not provide a standardized way to query the card's speed class directly. Therefore, the application cannot retrieve this information reliably. While we could theoretically perform a write speed test ourselves, implementing such a feature seems out of scope for a core Camera application.

I have reviewed the CameraX API but could not find a method to obtain the size of the VideoRecorder's internal buffer. The VideoRecordEvent.RecordingStats only provides information about the number of bytes written.

Question: Is there any way to access or determine the size of the VideoRecorder buffer in CameraX?

13:21:54.723   300   300 I lowmemorykiller: Kill 'com.some.store:AppMetrica' (19951), uid 10029, oom_score_adj 945 to free 31888kB rss, 55172kB swap; reason: min watermark is breached and thrashing (109%)
13:21:55.264   300   300 I lowmemorykiller: Kill 'com.some.browser:AppMetrica' (20255), uid 10062, oom_score_adj 935 to free 28300kB rss, 60048kB swap; reason: min watermark is breached and thrashing (97%)
13:21:55.294   300   300 I lowmemorykiller: Kill 'com.android.externalstorage' (20190), uid 10026, oom_score_adj 925 to free 29096kB rss, 43668kB swap; reason: min watermark is breached even after kill
13:21:55.313   300   300 I lowmemorykiller: Kill 'android.process.media' (20359), uid 10017, oom_score_adj 915 to free 29816kB rss, 44084kB swap; reason: min watermark is breached even after kill
13:21:55.330   300   300 I lowmemorykiller: Kill 'com.some.browser' (20208), uid 10062, oom_score_adj 905 to free 32088kB rss, 60924kB swap; reason: min watermark is breached even after kill
13:21:55.445   300   300 W lowmemorykiller: Failed to open /proc/20255/oom_score_adj; errno=2: process 20255 might have been killed
13:21:55.805   300   300 I lowmemorykiller: Kill 'tech.nda.packageupdateservice' (19861), uid 10077, oom_score_adj 800 to free 29388kB rss, 44916kB swap; reason: low watermark is breached and thrashing (85%)
13:21:56.333   300   300 I lowmemorykiller: Kill 'com.some.store' (19889), uid 10029, oom_score_adj 500 to free 34428kB rss, 64752kB swap; reason: min watermark is breached and thrashing (86%)
13:21:56.358   300   300 I lowmemorykiller: Kill 'tech.nda.keyboard' (20106), uid 10050, oom_score_adj 200 to free 33636kB rss, 263024kB swap; reason: min watermark is breached even after kill
13:21:56.669   630 21208 I DropBoxManagerService: add tag=system_server_lowmem isTagEnabled=true flags=0x6
13:21:58.050   300   300 I lowmemorykiller: Kill 'com.android.launcher3' (15014), uid 10081, oom_score_adj 100 to free 45836kB rss, 71900kB swap; reason: min watermark is breached and thrashing (208%)
13:21:59.122   300   300 I lowmemorykiller: Kill 'android.ext.services' (15151), uid 10096, oom_score_adj 100 to free 28972kB rss, 45024kB swap; reason: min watermark is breached and thrashing (209%)
13:21:59.144   300   300 I lowmemorykiller: Kill 'com.android.smspush' (15396), uid 10088, oom_score_adj 100 to free 26464kB rss, 44012kB swap; reason: min watermark is breached even after kill
13:21:59.151   300   300 I lowmemorykiller: Kill 'tech.nda.camera' (20888), uid 10086, oom_score_adj 0 to free 360160kB rss, 242184kB swap; reason: min watermark is breached even after kill
13:21:59.253   300   300 I lowmemorykiller: Kill '<pre-initialized>' (21209), uid 10077, oom_score_adj 0 to free 23544kB rss, 43688kB swap; reason: min watermark is breached even after kill
13:22:02.134   300   300 I lowmemorykiller: Kill '<pre-initialized>' (21227), uid 10081, oom_score_adj 0 to free 29096kB rss, 39216kB swap; reason: min watermark is breached and thrashing (489%)
13:22:06.907   300   300 I lowmemorykiller: Kill 'com.android.launcher3' (21243), uid 10081, oom_score_adj 0 to free 38240kB rss, 38804kB swap; reason: min watermark is breached and thrashing (209%)
13:22:07.781   300   300 I lowmemorykiller: Kill 'com.some.store' (21260), uid 10029, oom_score_adj 0 to free 32868kB rss, 37636kB swap; reason: min watermark is breached and thrashing (201%)
Reply all
Reply to author
Forward
0 new messages