summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authorSpike Sprague <spikuru@google.com>2014-04-29 17:46:01 -0700
committerSpike Sprague <spikuru@google.com>2014-04-29 17:46:01 -0700
commit6db1236ecd6b33b4fd1042570cc0d725634a5276 (patch)
tree64f61038ac7656cbdf8e7519f6068b84c1e9ef0d /src/com/android/camera/VideoModule.java
parent85cb6f2cbf4d3506a3cf423941f0e25f41f0b280 (diff)
parente903ae3fc0fc7a98bfc21129ac7ca8ee7ce98fec (diff)
downloadandroid_packages_apps_Camera2-6db1236ecd6b33b4fd1042570cc0d725634a5276.tar.gz
android_packages_apps_Camera2-6db1236ecd6b33b4fd1042570cc0d725634a5276.tar.bz2
android_packages_apps_Camera2-6db1236ecd6b33b4fd1042570cc0d725634a5276.zip
resolved conflicts for merge of e903ae3f to ub-camera-everglades
Change-Id: Ic0ea3fdfd5bad7ea3a576c3bc1ab7fddd7b557bc
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java113
1 files changed, 60 insertions, 53 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index b4dbfca10..bee5863a7 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -332,6 +332,8 @@ public class VideoModule extends CameraModule
SettingsManager settingsManager = mActivity.getSettingsManager();
mCameraId = Integer.parseInt(settingsManager.get(SettingsManager.SETTING_CAMERA_ID));
+ mActivity.updateStorageSpaceAndHint(null);
+
/*
* To reduce startup time, we start the preview in another thread.
* We make sure the preview is started at the end of onCreate.
@@ -355,7 +357,6 @@ public class VideoModule extends CameraModule
mShutterIconId = CameraUtil.getCameraShutterIconId(
mAppController.getCurrentModuleIndex(), mAppController.getAndroidContext());
-
}
@Override
@@ -1198,7 +1199,7 @@ public class VideoModule extends CameraModule
if (what == MediaRecorder.MEDIA_RECORDER_ERROR_UNKNOWN) {
// We may have run out of space on the sdcard.
stopVideoRecording();
- mActivity.updateStorageSpaceAndHint();
+ mActivity.updateStorageSpaceAndHint(null);
}
}
@@ -1241,57 +1242,60 @@ public class VideoModule extends CameraModule
mUI.showFocusUI(false);
mUI.showVideoRecordingHints(false);
- mActivity.updateStorageSpaceAndHint();
- if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
- Log.w(TAG, "Storage issue, ignore the start request");
- return;
- }
-
- //??
- //if (!mCameraDevice.waitDone()) return;
- mCurrentVideoUri = null;
-
- initializeRecorder();
- if (mMediaRecorder == null) {
- Log.e(TAG, "Fail to initialize media recorder");
- return;
- }
-
- pauseAudioPlayback();
-
- try {
- mMediaRecorder.start(); // Recording is now started
- } catch (RuntimeException e) {
- Log.e(TAG, "Could not start media recorder. ", e);
- releaseMediaRecorder();
- // If start fails, frameworks will not lock the camera for us.
- mCameraDevice.lock();
- return;
- }
- mAppController.getCameraAppUI().setSwipeEnabled(false);
-
- // The parameters might have been altered by MediaRecorder already.
- // We need to force mCameraDevice to refresh before getting it.
- mCameraDevice.refreshParameters();
- // The parameters may have been changed by MediaRecorder upon starting
- // recording. We need to alter the parameters if we support camcorder
- // zoom. To reduce latency when setting the parameters during zoom, we
- // update mParameters here once.
- mParameters = mCameraDevice.getParameters();
-
- mMediaRecorderRecording = true;
- mActivity.lockOrientation();
- mRecordingStartTime = SystemClock.uptimeMillis();
+ mActivity.updateStorageSpaceAndHint(new CameraActivity.OnStorageUpdateDoneListener() {
+ @Override
+ public void onStorageUpdateDone(long bytes) {
+ if (bytes <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
+ Log.w(TAG, "Storage issue, ignore the start request");
+ } else {
+ //??
+ //if (!mCameraDevice.waitDone()) return;
+ mCurrentVideoUri = null;
+
+ initializeRecorder();
+ if (mMediaRecorder == null) {
+ Log.e(TAG, "Fail to initialize media recorder");
+ return;
+ }
- // A special case of mode options closing: during capture it should
- // not be possible to change mode state.
- mAppController.getCameraAppUI().hideModeOptions();
- mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);
- mUI.showRecordingUI(true);
+ pauseAudioPlayback();
- setFocusParameters();
- updateRecordingTime();
- mActivity.enableKeepScreenOn(true);
+ try {
+ mMediaRecorder.start(); // Recording is now started
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Could not start media recorder. ", e);
+ releaseMediaRecorder();
+ // If start fails, frameworks will not lock the camera for us.
+ mCameraDevice.lock();
+ return;
+ }
+ mAppController.getCameraAppUI().setSwipeEnabled(false);
+
+ // The parameters might have been altered by MediaRecorder already.
+ // We need to force mCameraDevice to refresh before getting it.
+ mCameraDevice.refreshParameters();
+ // The parameters may have been changed by MediaRecorder upon starting
+ // recording. We need to alter the parameters if we support camcorder
+ // zoom. To reduce latency when setting the parameters during zoom, we
+ // update mParameters here once.
+ mParameters = mCameraDevice.getParameters();
+
+ mMediaRecorderRecording = true;
+ mActivity.lockOrientation();
+ mRecordingStartTime = SystemClock.uptimeMillis();
+
+ // A special case of mode options closing: during capture it should
+ // not be possible to change mode state.
+ mAppController.getCameraAppUI().hideModeOptions();
+ mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);
+ mUI.showRecordingUI(true);
+
+ setFocusParameters();
+ updateRecordingTime();
+ mActivity.enableKeepScreenOn(true);
+ }
+ }
+ });
}
private Bitmap getVideoThumbnail() {
@@ -1394,8 +1398,11 @@ public class VideoModule extends CameraModule
mParameters = mCameraDevice.getParameters();
}
- // Redo storage space calculation so it's accurate for the next video recording.
- mActivity.updateStorageSpaceAndHint();
+ // Check this in advance of each shot so we don't add to shutter
+ // latency. It's true that someone else could write to the SD card
+ // in the mean time and fill it, but that could have happened
+ // between the shutter press and saving the file too.
+ mActivity.updateStorageSpaceAndHint(null);
return fail;
}