Merge "Remove code introduced by mistake in MR0" into ics-mr0
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index 5e8bfc1..bd0aff5 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -89,6 +89,7 @@
private String mOutputFile;
private FileDescriptor mFd;
private int mOrientationHint = 0;
+ private long mMaxFileSize = 0;
private int mCameraFacing = Camera.CameraInfo.CAMERA_FACING_BACK;
private int mEffect = EFFECT_NONE;
@@ -214,6 +215,16 @@
mFd = fd;
}
+ /**
+ * Sets the maximum filesize (in bytes) of the recording session.
+ * This will be passed on to the MediaEncoderFilter and then to the
+ * MediaRecorder ultimately. If zero or negative, the MediaRecorder will
+ * disable the limit
+ */
+ public synchronized void setMaxFileSize(long maxFileSize) {
+ mMaxFileSize = maxFileSize;
+ }
+
public void setPreviewDisplay(SurfaceHolder previewSurfaceHolder,
int previewWidth,
int previewHeight) {
@@ -591,6 +602,7 @@
}
recorder.setInputValue("recording", true);
if (mRecordSound != null) mRecordSound.play();
+ recorder.setInputValue("maxFileSize", mMaxFileSize);
mState = STATE_RECORD;
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 2907c52..df8adb9 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -71,7 +71,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.FileDescriptor;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
@@ -1279,6 +1278,7 @@
Intent intent = getIntent();
Bundle myExtras = intent.getExtras();
+ long requestedSizeLimit = 0;
if (mIsVideoCaptureIntent && myExtras != null) {
Uri saveUri = (Uri) myExtras.getParcelable(MediaStore.EXTRA_OUTPUT);
if (saveUri != null) {
@@ -1291,6 +1291,7 @@
Log.e(TAG, ex.toString());
}
}
+ requestedSizeLimit = myExtras.getLong(MediaStore.EXTRA_SIZE_LIMIT);
}
// TODO: Timelapse
@@ -1302,6 +1303,13 @@
generateVideoFilename(mProfile.fileFormat);
mEffectsRecorder.setOutputFile(mVideoFilename);
}
+
+ // Set maximum file size.
+ long maxFileSize = mStorageSpace - Storage.LOW_STORAGE_THRESHOLD;
+ if (requestedSizeLimit > 0 && requestedSizeLimit < maxFileSize) {
+ maxFileSize = requestedSizeLimit;
+ }
+ mEffectsRecorder.setMaxFileSize(maxFileSize);
}