diff options
author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-11-30 00:57:47 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-11-30 00:57:47 -0800 |
commit | 9da895740b071c2cc3fe1d23b7862f635166da16 (patch) | |
tree | 039f4d53f9bbb3ba0263a3af9ff1cd7d6096d83d /src | |
parent | d2ad03b608bf1fc506102851631fcb8d7434043a (diff) | |
parent | 57edb53677cebeb2d5d554e7c3f975b6cb073007 (diff) | |
download | android_packages_apps_Snap-9da895740b071c2cc3fe1d23b7862f635166da16.tar.gz android_packages_apps_Snap-9da895740b071c2cc3fe1d23b7862f635166da16.tar.bz2 android_packages_apps_Snap-9da895740b071c2cc3fe1d23b7862f635166da16.zip |
Merge "SnapdragonCamera:Fix recording audio leg"
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/camera/CaptureModule.java | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index e725faaf3..105e2381a 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -3165,31 +3165,7 @@ public class CaptureModule implements CameraModule, PhotoController, try { setUpMediaRecorder(cameraId); - try { - mMediaRecorder.start(); // Recording is now started - } catch (RuntimeException e) { - Toast.makeText(mActivity,"Could not start media recorder.\n " + - "Can't start video recording.", Toast.LENGTH_LONG).show(); - releaseMediaRecorder(); - releaseAudioFocus(); - mStartRecPending = false; - mIsRecordingVideo = false; - return false; - } - if (mUnsupportedResolution == true ) { - Log.v(TAG, "Unsupported Resolution according to target"); - mStartRecPending = false; - mIsRecordingVideo = false; - return false; - } - if (mMediaRecorder == null) { - Log.e(TAG, "Fail to initialize media recorder"); - mStartRecPending = false; - mIsRecordingVideo = false; - return false; - } - requestAudioFocus(); mUI.clearFocus(); mUI.hideUIwhileRecording(); mCameraHandler.removeMessages(CANCEL_TOUCH_FOCUS, mCameraId[cameraId]); @@ -3259,6 +3235,13 @@ public class CaptureModule implements CameraModule, PhotoController, + e.getMessage()); e.printStackTrace(); } + if (!startMediaRecorder()) { + mUI.showUIafterRecording(); + releaseMediaRecorder(); + mFrameProcessor.setVideoOutputSurface(null); + restartSession(true); + return; + } mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; @@ -3294,6 +3277,14 @@ public class CaptureModule implements CameraModule, PhotoController, } catch (IllegalStateException e) { e.printStackTrace(); } + if (!startMediaRecorder()) { + mUI.showUIafterRecording(); + releaseMediaRecorder(); + mFrameProcessor.setVideoOutputSurface(null); + restartSession(true); + return; + } + mUI.clearFocus(); mUI.resetPauseButton(); mRecordingTotalTime = 0L; @@ -3318,6 +3309,35 @@ public class CaptureModule implements CameraModule, PhotoController, return true; } + private boolean startMediaRecorder() { + try { + mMediaRecorder.start(); // Recording is now started + } catch (RuntimeException e) { + Toast.makeText(mActivity,"Could not start media recorder.\n " + + "Can't start video recording.", Toast.LENGTH_LONG).show(); + releaseMediaRecorder(); + releaseAudioFocus(); + mStartRecPending = false; + mIsRecordingVideo = false; + return false; + } + if (mUnsupportedResolution == true ) { + Log.v(TAG, "Unsupported Resolution according to target"); + mStartRecPending = false; + mIsRecordingVideo = false; + return false; + } + if (mMediaRecorder == null) { + Log.e(TAG, "Fail to initialize media recorder"); + mStartRecPending = false; + mIsRecordingVideo = false; + return false; + } + + requestAudioFocus(); + return true; + } + private void updateTimeLapseSetting() { String value = mSettingsManager.getValue(SettingsManager .KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL); |