USB摄像头常见问题
预览闪退
-
原因分析 摄像头不支持默认预览分辨率 -
解决方法:配置USB摄像头预览分辨率 $ vim hardware/rockchip/camera/CameraHal/CameraUSBAdapter.cpp
@@ -135,7 +135,7 @@ void CameraUSBAdapter::initDefaultParameters(int camFd)
params.set(KEY_PREVIEW_W_FORCE,"0");
params.set(KEY_PREVIEW_H_FORCE,"0");
params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, parameterString.string());
- params.setPreviewSize(640,480);
+ params.setPreviewSize(320,240);
/*picture size setting*/
params.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, parameterString.string());
params.setPictureSize(mCamDriverFrmWidthMax, mCamDriverFrmHeightMax);
拍照闪退
-
原因分析 摄像头不支持默认拍照分辨率 -
解决方法:配置USB摄像头默认拍照分辨率 $ vim hardware/rockchip/camera/CameraHal/CameraAdapter.cpp
@@ -168,7 +168,8 @@ bool CameraAdapter::getFlashStatus()
}
status_t CameraAdapter::startPreview(int preview_w,int preview_h,int w, int h, int fmt,bool is_capture)
{
-
+ w = 640;
+ h = 480;
//create buffer
LOG_FUNCTION_NAME
unsigned int frame_size = 0,i;
录像闪退
-
原因分析 摄像头不支持默认录像分辨率,必须修改为支持录像分辨率 -
解决方法:配置USB摄像头录像分辨率 $ vim frameworks/av/media/libstagefright/CameraSource.cpp
@@ -493,6 +493,10 @@ status_t CameraSource::init(
int32_t frameRate,
bool storeMetaDataInVideoBuffers) {
+ videoSize.width = 640;
+ videoSize.height = 480;
+ frameRate = 15;
ALOGV("init");
status_t err = OK;
int64_t token = IPCThreadState::self()->clearCallingIdentity();
|