summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoCamera.java
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-02-24 15:22:51 +0800
committerWu-cheng Li <wuchengli@google.com>2011-02-24 18:21:35 +0800
commitd27cd2ac1d65481d40a50dc9f0b3fe0d8e845fa0 (patch)
treeaf7d7f998e7e6a9b8db7d3bae3591f7a4db3e6a8 /src/com/android/camera/VideoCamera.java
parent8b590562327f6ac95f8e7eac764b05ae43a49299 (diff)
downloadLegacyCamera-d27cd2ac1d65481d40a50dc9f0b3fe0d8e845fa0.zip
LegacyCamera-d27cd2ac1d65481d40a50dc9f0b3fe0d8e845fa0.tar.gz
LegacyCamera-d27cd2ac1d65481d40a50dc9f0b3fe0d8e845fa0.tar.bz2
Close video fd after recording is done.
MediaRecorder sets the fd in prepare(). If camcorder closes fd before that, fd will be -1 and prepare will fail. bug:3471488 Change-Id: I72840ae8eb06a475a2d13745a15c57911558c97c
Diffstat (limited to 'src/com/android/camera/VideoCamera.java')
-rw-r--r--src/com/android/camera/VideoCamera.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 0870de6..3b29c9e 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1169,11 +1169,6 @@ public class VideoCamera extends NoSearchActivity
// instead.
if (mVideoFileDescriptor != null) {
mMediaRecorder.setOutputFile(mVideoFileDescriptor.getFileDescriptor());
- try {
- mVideoFileDescriptor.close();
- } catch (IOException e) {
- Log.e(TAG, "Fail to close fd", e);
- }
} else {
generateVideoFilename(mProfile.fileFormat);
mMediaRecorder.setOutputFile(mVideoFilename);
@@ -1233,6 +1228,15 @@ public class VideoCamera extends NoSearchActivity
mMediaRecorder.release();
mMediaRecorder = null;
}
+ mVideoFilename = null;
+ if (mVideoFileDescriptor != null) {
+ try {
+ mVideoFileDescriptor.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Fail to close fd", e);
+ }
+ mVideoFileDescriptor = null;
+ }
// Take back the camera object control from media recorder. Camera
// device may be null if the activity is paused.
if (mCameraDevice != null) mCameraDevice.lock();
@@ -1588,8 +1592,6 @@ public class VideoCamera extends NoSearchActivity
if (needToRegisterRecording && mStorageSpace >= LOW_STORAGE_THRESHOLD) {
registerVideo();
}
- mVideoFilename = null;
- mVideoFileDescriptor = null;
}
releaseMediaRecorder(); // always release media recorder
}