From 2ecc5b98821c847162c865fb7d798da79b7699f4 Mon Sep 17 00:00:00 2001 From: Sultanxda Date: Fri, 6 Nov 2015 21:03:32 -0800 Subject: SnapdragonCamera: Fix timelapse recording Audio should not be encoded when the timelapse feature is used. This fixes the force close when attempting to record a timelapse video. Change-Id: I376372b316a7a75b0883e6c93eb1d827e4007a04 Signed-off-by: Sultanxda --- src/com/android/camera/VideoModule.java | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 3ca6db31a..c87a797fd 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1580,23 +1580,19 @@ public class VideoModule implements CameraModule, mProfile.audioCodec = mAudioEncoder; mProfile.duration = mMaxVideoDurationInMs; - // Set params individually for HFR case, as we do not want to encode audio - if ((isHFR || isHSR) && captureRate > 0) { - if (isHFR) { - mMediaRecorder.setOutputFormat(mProfile.fileFormat); - mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate); - mMediaRecorder.setVideoEncodingBitRate(mProfile.videoBitRate); - mMediaRecorder.setVideoEncoder(mProfile.videoCodec); - } else if (isHSR) { - mProfile.videoBitRate *= captureRate / 30; - mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); - mMediaRecorder.setProfile(mProfile); - } + // Set params individually for HFR and timelapse + // cases, as we do not want to encode audio + if (isHFR || mCaptureTimeLapse) { + mMediaRecorder.setOutputFormat(mProfile.fileFormat); + mMediaRecorder.setVideoFrameRate(mProfile.videoFrameRate); + mMediaRecorder.setVideoEncodingBitRate(mProfile.videoBitRate); + mMediaRecorder.setVideoEncoder(mProfile.videoCodec); + } else if (isHSR) { + mProfile.videoBitRate *= captureRate / 30; + mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); + mMediaRecorder.setProfile(mProfile); } else { - if (!mCaptureTimeLapse) { - mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); - } - + mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER); mMediaRecorder.setProfile(mProfile); } -- cgit v1.2.3