saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.96k stars 1.19k forks source link

[Test2] Problem with video recording: dequeueBuffer failed (Out of memory). #575

Open sasygoll opened 3 years ago

sasygoll commented 3 years ago

I'm trying to capture video from USB Camera, but when I press the button I get this error: dequeueBuffer failed (Out of memory) at the end the video created is empty. Help mee thanks.

This is my log:

Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. W/.usbcameratest: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) W/.usbcameratest: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... W/Gralloc3: mapper 3.x is not supported D/OpenGLRenderer: endAllActiveAnimators on 0x87aadd00 (RippleDrawable) with handle 0x87a827d0 D/UsbDeviceConnectionJNI: close I/USBMonitor: name=/dev/bus/usb/001/005,desc=54,busnum=1,devnum=5,rawDesc=[B@7d345f4 D/UsbDeviceConnectionJNI: close I/libusb/core: [3526core.c:2085:libusb_init2]:libusb v1.0.19.10903 I/libusb/usbfs: [3526android_usbfs.c:504:op_init2]:start up hotplug event handler [3526android_usbfs.c:512:op_init2]:call android_scan_devices I/MainActivity: supportedSize:{"formats":[{"index":1,"type":4,"default":1,"size":["640x480","160x120","176x144","320x180","320x240","352x288","424x240","480x270","640x360","800x448","800x600","848x480","960x540","1024x576","1280x720","1600x896","1920x1080","2304x1296","2304x1536"]},{"index":2,"type":6,"default":1,"size":["640x480","160x120","176x144","320x180","320x240","352x288","424x240","480x270","640x360","800x448","800x600","848x480","960x540","1024x576","1280x720","1600x896","1920x1080"]}]} I/libUVCCamera: [3539UVCPreview.cpp:492:prepare_preview]:frameSize=(640,480)@MJPEG W/libUVCCamera: [3540UVCPreview.cpp:119:get_frame]:allocate new frame W/libUVCCamera: [3539UVCPreview.cpp:119:get_frame]:allocate new frame W/Gralloc3: allocator 3.x is not supported V/MainActivity: startCapture: D/Encoder: Encoder thread starting I/SurfaceEncoder: prepare: I/SurfaceEncoder: selected codec: c2.android.avc.encoder format: {color-format=2130708361, i-frame-interval=10, mime=video/avc, width=640, bitrate=1000000, frame-rate=15, height=480} D/CCodec: allocate(c2.android.avc.encoder) I/Codec2Client: Available Codec2 services: "software" Creating a Codec2 client to service "software" I/Codec2Client: Client to Codec2 service "software" created I/CCodec: Created component [c2.android.avc.encoder] D/CCodecConfig: read media type: video/avc D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.max-count.values D/ReflectedParamUpdater: extent() != 1 for single value type: output.subscribed-indices.values extent() != 1 for single value type: input.buffers.allocator-ids.values D/ReflectedParamUpdater: extent() != 1 for single value type: output.buffers.allocator-ids.values extent() != 1 for single value type: algo.buffers.allocator-ids.values extent() != 1 for single value type: output.buffers.pool-ids.values D/ReflectedParamUpdater: extent() != 1 for single value type: algo.buffers.pool-ids.values D/ReflectedParamUpdater: ignored struct field coding.gop.values I/CCodecConfig: query failed after returning 10 values (BAD_INDEX) D/CCodecConfig: c2 config diff is Dict { c2::u32 coded.bitrate.value = 64000 c2::float coded.frame-rate.value = 30 c2::u32 coded.pl.level = 20492 c2::u32 coded.pl.profile = 20481 c2::u32 coding.intra-refresh.mode = 0 c2::float coding.intra-refresh.period = 0 c2::u32 coding.request-sync-frame.value = 0 c2::i64 coding.sync-frame-interval.value = 1000000 c2::u32 input.delay.value = 0 string input.media-type.value = "video/raw" string output.media-type.value = "video/avc" c2::u32 raw.color.matrix = 0 c2::u32 raw.color.primaries = 0 c2::u32 raw.color.range = 0 c2::u32 raw.color.transfer = 0 c2::u32 raw.size.height = 240 c2::u32 raw.size.width = 320 } W/ColorUtils: expected specified color aspects (0:0:0:0) D/CCodecConfig: no c2 equivalents for color-format no c2 equivalents for encoder D/CCodecConfig: c2 config diff is c2::u32 coded.bitrate.value = 1000000 c2::float coded.frame-rate.value = 15 c2::i64 coding.sync-frame-interval.value = 10000000 c2::u32 raw.size.height = 480 c2::u32 raw.size.width = 640 W/ColorUtils: expected specified color aspects (0:0:0:0) D/CCodec: setup formats input: AMessage(what = 0x00000000) = { int32_t frame-rate = 15 int32_t height = 480 int32_t intra-refresh-period = 0 string mime = "video/raw" int32_t width = 640 Rect crop(0, 0, 639, 479) int32_t android._dataspace = 0 int32_t using-sw-read-often = 1 int32_t color-format = 2130708361 } and output: AMessage(what = 0x00000000) = { int32_t bitrate = 1000000 Rect crop(0, 0, 639, 479) int32_t color-standard = 0 int32_t color-range = 0 int32_t color-transfer = 0 int32_t frame-rate = 15 int32_t height = 480 int32_t intra-refresh-period = 0 int32_t level = 4096 int32_t max-bitrate = 1000000 string mime = "video/avc" int32_t profile = 65536 int32_t width = 640 } D/CCodec: input format changed to AMessage(what = 0x00000000) = { int32_t frame-rate = 15 int32_t height = 480 int32_t intra-refresh-period = 0 string mime = "video/raw" int32_t width = 640 Rect crop(0, 0, 639, 479) int32_t android._dataspace = 259 int32_t using-sw-read-often = 1 int32_t color-format = 2130708361 int32_t color-range = 2 int32_t color-standard = 4 int32_t color-transfer = 3 } D/CCodec: ISConfig timeLapse 0fps as 0fps (=> INVALID_OPERATION) start at 0us W/Codec2Client: query -- param skipped: index = 1342179345. query -- param skipped: index = 2415921170. D/CCodecBufferChannel: [c2.android.avc.encoder#280] Using basic input block pool with poolID 1 => got 1 - OK (0) I/CCodecBufferChannel: [c2.android.avc.encoder#280] Created output block pool with allocatorID 16 => poolID 20 - OK D/CCodecBufferChannel: [c2.android.avc.encoder#280] Configured output block pool ids 20 => OK I/SurfaceEncoder: output will go to /storage/emulated/0/Movies/USBCameraTest/2020-10-08-07-43-43.mp4 V/MainActivity: onPreapared: V/Encoder: startRecording E/Surface: dequeueBuffer failed (Out of memory) W/libUVCCamera: [3539*UVCPreview.cpp:119:get_frame]:allocate new frame E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) E/Surface: dequeueBuffer failed (Out of memory) V/MainActivity: stopCapture: V/Encoder: stopRecording D/Encoder: sending EOS to encoder I/SurfaceEncoder: release: D/Encoder: release: V/MainActivity: onRelease: D/Encoder: Encoder thread exiting