Open eson-yunfei opened 5 years ago
this is log:
2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 I/MainActivity: supportedSize:{"formats":[{"index":1,"type":6,"default":1,"size":["1920x1080","160x120","320x240","352x288","640x480","800x600","1024x768","1280x720","1280x1024","1600x1200","1920x1080"]},{"index":2,"type":4,"default":1,"size":["640x480","1920x1080","1280x720","800x600","960x540"]}]} 2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 D/Surface: Surface::setBuffersUserDimensions(this=0x94b15830,w=640,h=480) 2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 E/libUVCCamera: [8989UVCPreview.cpp:330:startPreview]:UVCPreview::startPreview() ========= 2019-05-30 10:50:45.426 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:474:preview_thread_func]:UVCPreview::preview_thread_func() ========= 2019-05-30 10:50:45.441 8973-9006/com.serenegiant.usbcameratest0 I/libUVCCamera: [9006UVCPreview.cpp:507:prepare_preview]:frameSize=(640,480)@MJPEG 2019-05-30 10:50:45.441 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:529:do_preview]: =========== do_preview ========== 2019-05-30 10:50:45.723 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:544:do_preview]: =========== frameMode MJPEG ========== 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:440:waitPreviewFrame]:pthread_mutex_lock 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:442:waitPreviewFrame]:previewFrames.size() : 0 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:445:waitPreviewFrame]:pthread_cond_wait
this is code :
void UVCPreview::do_preview(uvc_stream_ctrl_t ctrl) { ENTER(); LOGE(" =========== do_preview =========="); uvc_frame_t frame = NULL; uvc_frame_t frame_mjpeg = NULL; uvc_error_t result = uvc_start_streaming_bandwidth( mDeviceHandle, ctrl, uvc_preview_frame_callback, (void )this, requestBandwidth, 0);
if (LIKELY(!result)) { clearPreviewFrame(); pthread_create(&capture_thread, NULL, capture_thread_func, (void *)this);
LOGE("Streaming...");
if (frameMode) { // MJPEG mode LOGE(" =========== frameMode MJPEG =========="); for ( ; LIKELY(isRunning()) ; ) { frame_mjpeg = waitPreviewFrame(); if (LIKELY(frame_mjpeg)) { frame = get_frame(frame_mjpeg->width * frame_mjpeg->height * 2); result = uvc_mjpeg2yuyv(frame_mjpeg, frame); // MJPEG => yuyv // result = uvc_mjpeg2rgb565(frame_mjpeg, frame); LOGE(" uvc_mjpeg2yuyv result is %d",result); recycle_frame(frame_mjpeg); if (LIKELY(!result)) { LOGE(" draw_preview_one " ); frame = draw_preview_one(frame, &mPreviewWindow, uvc_any2rgbx, 4); addCaptureFrame(frame); } else { LOGE(" recycle_frame " ); recycle_frame(frame); } } } } else { // yuvyv mode LOGE(" =========== frameMode yuvyv :%d========== ",isRunning()); for ( ; LIKELY(isRunning()) ; ) { LOGE(" =========== frame for =========="); frame = waitPreviewFrame(); LOGE(" =========== waitPreviewFrame =========="); if (LIKELY(frame)) { LOGE(" =========== addCaptureFrame =========="); frame = draw_preview_one(frame, &mPreviewWindow, uvc_any2rgbx, 4); addCaptureFrame(frame); } } } pthread_cond_signal(&capture_sync);
LOGE("preview_thread_func:wait for all callbacks complete");
uvc_stop_streaming(mDeviceHandle);
LOGE("Streaming finished");
} else { uvc_perror(result, "failed start_streaming"); } EXIT();
}
this is log:
2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 I/MainActivity: supportedSize:{"formats":[{"index":1,"type":6,"default":1,"size":["1920x1080","160x120","320x240","352x288","640x480","800x600","1024x768","1280x720","1280x1024","1600x1200","1920x1080"]},{"index":2,"type":4,"default":1,"size":["640x480","1920x1080","1280x720","800x600","960x540"]}]} 2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 D/Surface: Surface::setBuffersUserDimensions(this=0x94b15830,w=640,h=480) 2019-05-30 10:50:45.425 8973-8989/com.serenegiant.usbcameratest0 E/libUVCCamera: [8989UVCPreview.cpp:330:startPreview]:UVCPreview::startPreview() ========= 2019-05-30 10:50:45.426 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:474:preview_thread_func]:UVCPreview::preview_thread_func() ========= 2019-05-30 10:50:45.441 8973-9006/com.serenegiant.usbcameratest0 I/libUVCCamera: [9006UVCPreview.cpp:507:prepare_preview]:frameSize=(640,480)@MJPEG 2019-05-30 10:50:45.441 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:529:do_preview]: =========== do_preview ========== 2019-05-30 10:50:45.723 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:544:do_preview]: =========== frameMode MJPEG ========== 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:440:waitPreviewFrame]:pthread_mutex_lock 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:442:waitPreviewFrame]:previewFrames.size() : 0 2019-05-30 10:50:45.724 8973-9006/com.serenegiant.usbcameratest0 E/libUVCCamera: [9006UVCPreview.cpp:445:waitPreviewFrame]:pthread_cond_wait
this is code :
void UVCPreview::do_preview(uvc_stream_ctrl_t ctrl) { ENTER(); LOGE(" =========== do_preview =========="); uvc_frame_t frame = NULL; uvc_frame_t frame_mjpeg = NULL; uvc_error_t result = uvc_start_streaming_bandwidth( mDeviceHandle, ctrl, uvc_preview_frame_callback, (void )this, requestBandwidth, 0);
if LOCAL_DEBUG
endif
if LOCAL_DEBUG
endif
if LOCAL_DEBUG
endif
}