summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 424f187b3..c46b424b8 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -1106,8 +1106,7 @@ public class VideoModule implements CameraModule,
mOrientationManager.resume();
// Initialize location service.
- boolean recordLocation = RecordLocationPreference.get(mPreferences,
- mContentResolver);
+ boolean recordLocation = RecordLocationPreference.get(mPreferences);
mLocationManager.recordLocation(recordLocation);
if (mPreviewing) {
@@ -1487,6 +1486,10 @@ public class VideoModule implements CameraModule,
mProfile.audioCodec = mAudioEncoder;
mProfile.duration = mMaxVideoDurationInMs;
+ if ((mProfile.audioCodec == MediaRecorder.AudioEncoder.AMR_NB) &&
+ !mCaptureTimeLapse && !isHFR) {
+ mProfile.fileFormat = MediaRecorder.OutputFormat.THREE_GPP;
+ }
// Set params individually for HFR case, as we do not want to encode audio
if ((isHFR || isHSR) && captureRate > 0) {
if (isHSR) {
@@ -1737,13 +1740,23 @@ public class VideoModule implements CameraModule,
// Send request to obtain audio focus. This will stop other
// music stream.
int result = am.requestAudioFocus(null, AudioManager.STREAM_MUSIC,
- AudioManager.AUDIOFOCUS_GAIN);
+ AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
Log.v(TAG, "Audio focus request failed");
}
}
+ private void releaseAudioFocus() {
+ AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
+
+ int result = am.abandonAudioFocus(null);
+
+ if (result == AudioManager.AUDIOFOCUS_REQUEST_FAILED) {
+ Log.v(TAG, "Audio focus release failed");
+ }
+ }
+
// For testing.
public boolean isRecording() {
return mMediaRecorderRecording;
@@ -1816,6 +1829,7 @@ public class VideoModule implements CameraModule,
} catch (RuntimeException e) {
Toast.makeText(mActivity,"Could not start media recorder.\n Can't start video recording.", Toast.LENGTH_LONG).show();
releaseMediaRecorder();
+ releaseAudioFocus();
// If start fails, frameworks will not lock the camera for us.
mCameraDevice.lock();
mStartRecPending = false;
@@ -1966,6 +1980,7 @@ public class VideoModule implements CameraModule,
}
// release media recorder
releaseMediaRecorder();
+ releaseAudioFocus();
if (!mPaused) {
mCameraDevice.lock();
if (!ApiHelper.HAS_SURFACE_TEXTURE_RECORDING) {
@@ -2689,8 +2704,7 @@ public class VideoModule implements CameraModule,
// startPreview().
if (mCameraDevice == null) return;
- boolean recordLocation = RecordLocationPreference.get(
- mPreferences, mContentResolver);
+ boolean recordLocation = RecordLocationPreference.get(mPreferences);
mLocationManager.recordLocation(recordLocation);
readVideoPreferences();