Fixed Exception on some devices when we use default videoCodec instead CamcorderProfile videoCodec.

pull/264/head
alexander.melnikov 7 years ago
parent 4c6a8db0c3
commit 198925b2ee
  1. 4
      cameraview/src/main/java/com/otaliastudios/cameraview/Camera1.java

@ -688,7 +688,11 @@ class Camera1 extends CameraController implements Camera.PreviewCallback, Camera
mMediaRecorder.setOutputFormat(profile.fileFormat); mMediaRecorder.setOutputFormat(profile.fileFormat);
mMediaRecorder.setVideoFrameRate(profile.videoFrameRate); mMediaRecorder.setVideoFrameRate(profile.videoFrameRate);
mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
if (mVideoCodec == VideoCodec.DEFAULT) {
mMediaRecorder.setVideoEncoder(profile.videoCodec);
} else {
mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec)); mMediaRecorder.setVideoEncoder(mMapper.map(mVideoCodec));
}
mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate); mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate);
if (mAudio == Audio.ON) { if (mAudio == Audio.ON) {
mMediaRecorder.setAudioChannels(profile.audioChannels); mMediaRecorder.setAudioChannels(profile.audioChannels);

Loading…
Cancel
Save