Open faiz03249 opened 4 years ago
how about change you camera?
i changed camera as well . this method was working before . Now frames listener is not getting called on connecting camera .
I see. Let me check it.
I see. Let me check it.
how to do dual USB Camera??
Any news regarding this issue? I can't seem to get the listener to work. I want to capture the frame but nothing happens.
Got same issue. For me the problem was in following piece of code.
try {
mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, mPreviewMode, mBandwidthFactor);
// 获取USB Camera预览数据,使用NV21颜色会失真
// 无论使用YUV还是MPEG,setFrameCallback的设置效果一致
// mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_NV21);
mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP);
} catch (final IllegalArgumentException e) {
try {
// fallback to YUV mode
mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, UVCCamera.DEFAULT_PREVIEW_MODE, mBandwidthFactor);
} catch (final IllegalArgumentException e1) {
callOnError(e1);
return;
}
}
I got exception at
mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, mPreviewMode, mBandwidthFactor);
and jumped to catch block:
mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, UVCCamera.DEFAULT_PREVIEW_MODE, mBandwidthFactor);
which uses UVCCamera.DEFAULT_PREVIEW_MODE
but does not set frame callback.
Inserting mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP);
after this line fixed callback issue for me.
@jiangdongguo, looks like a bug. If so, is my fix correct?
Got same issue. For me the problem was in following piece of code.
try { mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, mPreviewMode, mBandwidthFactor); // 获取USB Camera预览数据,使用NV21颜色会失真 // 无论使用YUV还是MPEG,setFrameCallback的设置效果一致 // mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_NV21); mUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP); } catch (final IllegalArgumentException e) { try { // fallback to YUV mode mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, UVCCamera.DEFAULT_PREVIEW_MODE, mBandwidthFactor); } catch (final IllegalArgumentException e1) { callOnError(e1); return; } }
I got exception at
mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, mPreviewMode, mBandwidthFactor);
and jumped to catch block:mUVCCamera.setPreviewSize(mWidth, mHeight, 1, 31, UVCCamera.DEFAULT_PREVIEW_MODE, mBandwidthFactor);
which usesUVCCamera.DEFAULT_PREVIEW_MODE
but does not set frame callback. InsertingmUVCCamera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_YUV420SP);
after this line fixed callback issue for me.@jiangdongguo, looks like a bug. If so, is my fix correct?
Have you solved it
mCameraHelper.setOnPreviewFrameListener this method is not getting called .Not able to get the fram of the video.