Closed DanhDue closed 8 years ago
I have the same issue on Huawei P6 !
I found the solution ! the crash is due to "cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_FIXED)"
We need to verify if the camera supports the FOCUS MODE FIXED, so replace
if(focusModes != null){
Log.i("video", Build.MODEL);
if (((Build.MODEL.startsWith("GT-I950"))
|| (Build.MODEL.endsWith("SCH-I959"))
|| (Build.MODEL.endsWith("MEIZU MX3")))&&focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)){
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
}else if(focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)){
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}else
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_FIXED);
}
By
if(focusModes != null){
Log.i("video", Build.MODEL);
if (((Build.MODEL.startsWith("GT-I950"))
|| (Build.MODEL.endsWith("SCH-I959"))
|| (Build.MODEL.endsWith("MEIZU MX3")))&&focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)){
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
}else if(focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)){
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
}else if (focusModes.contains(Camera.Parameters.FOCUS_MODE_FIXED))
cameraParameters.setFocusMode(Camera.Parameters.FOCUS_MODE_FIXED);
}
Thank for support BackPackerDz!
hi , do anybody have idea how to delete last recoded frame in video recording , i stuck with it i don't getting how to do , it not issue so i feel to comment here would be better to ask by comment .
Dear sir,
I run your code on my device(Vega R3) that installed with custom rom(Android 5.1.1). When i click change front camera then app crash at handleSurfaceChanged method.
And Logs are showed:
02-04 09:22:32.738 195-195/? E/QualcommCamera: Qint android::set_parameters(cameradevice, const char_): E 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setParameters(const android::QCameraParameters&): E 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: ZSL is enabled 0 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: Enable Low Power Mode 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setPowerMode(const android::QCameraParameters&) Low power mode Enabled value = 1 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: ################requested preview size 640 x 480 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVideoSize(const android::QCameraParameters&): requested record size 800x480 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: Preview size is set with 640x480 02-04 09:22:32.738 195-195/? D/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVideoSize(const android::QCameraParameters&): preview dimensions: 640x480 02-04 09:22:32.738 195-195/? D/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVideoSize(const android::QCameraParameters&): video dimensions: 800x480 02-04 09:22:32.738 195-195/? D/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVideoSize(const android::QCameraParameters&): thumbnail dimensions: 480x288 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: ################requested picture size 640 x 480 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: requested jpeg thumbnail size 320 x 240 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setLensshadeValue(const android::QCameraParameters&):LENS SHADING not supported 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_MCE mode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setSharpness(const android::QCameraParameters&):CONTRAST not supported 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setSaturation(const android::QCameraParameters&):MM_CAMERA_PARM_SATURATION not supported 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setSceneMode(const android::QCameraParameters&):Parameter Scenemode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setContrast(const android::QCameraParameters&):CONTRAST not supported 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: Setting preview format to 1, i =0, num=4, hal_format=17 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: SkinToneEnhancement is not supported for this sensor 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setHDR(const android::CameraParameters&) 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: HDR string : hdr-off 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: HDR mCurrentHDR = 0, Value : 0 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: Wavelet Denoise is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: ANTIBANDING mode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: Parameter Redeye Reduction is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setPreviewFpsRange(const android::QCameraParameters&): No change in FpsRange 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_DIS_ENABLE mode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_FULL_LIVESHOT mode is not supported for this sensor 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: int android::QCameraHardwareInterface::getNumOfSnapshots(const android::QCameraParameters&): prop enable/disable = 0 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: number of snapshots = 1 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_AEC_LOCK mode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_ANTISHAKE mode is not supported for this sensor 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVTS(const android::CameraParameters&) 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: VTS string : off 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: VTS Value : 0 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setVEGAEYE(const android::CameraParameters&) 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: KEY_VEGAEYE string : vegaeye-off 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: KEY_VEGAEYEValue : 0 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setFlashApp(const android::CameraParameters&) 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: KEY_FLASH string : (null) 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_OJT mode is not supported for this sensor 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setFlash(const android::QCameraParameters&): E 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setFlash(const android::QCameraParameters&):LED FLASH not supported 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setFocusMode(const android::QCameraParameters&):Could not look up str value 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: Invalid focus mode value: fixed 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: MM_CAMERA_PARM_EXPOSURE_COMPENSATION mode is not supported for this sensor 02-04 09:22:32.738 195-195/? E/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setHighFrameRate(const android::QCameraParameters&): MM_CAMERA_PARM_HFR not supported 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setZSLBurstLookBack(const android::QCameraParameters&): look_back =0 02-04 09:22:32.748 728-1751/system_process W/ActivityManager: Force finishing activity 1 vn.inet.funtime/.activities.FFmpegRecorderActivity 02-04 09:22:32.738 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setZSLBurstInterval(const android::QCameraParameters&): Interval =1 02-04 09:22:32.738 195-195/? D/QCameraHWI_Parm: Param mNoDisplayMode =0 02-04 09:22:32.748 195-195/? I/QCameraHWI_Parm: int android::QCameraHardwareInterface::getISOSpeedValue(), iso_value - 0 02-04 09:22:32.748 195-195/? D/QCameraHWI_Parm: [CE] [1] [setColorExtraction] set pantech-colorextraction value = 0 02-04 09:22:32.748 195-195/? D/QCameraHWI_Parm: [CE] [2] [setColorExtraction] skip, colorExtraction on/off=off 02-04 09:22:32.748 195-195/? I/QCameraHWI_Parm: android::status_t android::QCameraHardwareInterface::setParameters(const android::QCameraParameters&): X 02-04 09:22:32.748 6607-6607/vn.inet.funtime D/AndroidRuntime: Shutting down VM 02-04 09:22:32.748 6607-6607/vn.inet.funtime E/AndroidRuntime: FATAL EXCEPTION: main Process: vn.inet.funtime, PID: 6607 java.lang.RuntimeException: setParameters failed at android.hardware.Camera.native_setParameters(Native Method) at android.hardware.Camera.setParameters(Camera.java:1972) at vn.inet.funtime.activities.FFmpegRecorderActivity.handleSurfaceChanged(FFmpegRecorderActivity.java:921) at vn.inet.funtime.activities.FFmpegRecorderActivity.access$2100(FFmpegRecorderActivity.java:85) at vn.inet.funtime.activities.FFmpegRecorderActivity$2.onPostExecute(FFmpegRecorderActivity.java:386) at vn.inet.funtime.activities.FFmpegRecorderActivity$2.onPostExecute(FFmpegRecorderActivity.java:360) at android.os.AsyncTask.finish(AsyncTask.java:636) at android.os.AsyncTask.access$500(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5293) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) 02-04 09:22:32.808 728-19847/system_process I/OpenGLRenderer: Initialized EGL, version 1.4 02-04 09:22:32.829 728-7061/system_process W/DropBoxManagerService: Dropping: data_app_crash (1338 > 0 bytes) 02-04 09:22:33.259 728-755/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{1c1a98d2 u0 vn.inet.funtime/.activities.FFmpegRecorderActivity t294 f} 02-04 09:22:42.758 728-755/system_process W/ActivityManager: Launch timeout has expired, giving up wake lock!
Please help me check bugs.
Thanks!