diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-01-05 14:33:00 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-01-05 14:33:00 +0800 |
commit | 446b319606f90abedfa1927d4d47ce50e6b965c3 (patch) | |
tree | 557cb730a9e818a0835a17a87ab7e46b152f5740 /src/com/android/camera/VideoCamera.java | |
parent | 894696f3f9f068a23696bbd05a5e9fc0d9ae5720 (diff) | |
download | LegacyCamera-446b319606f90abedfa1927d4d47ce50e6b965c3.zip LegacyCamera-446b319606f90abedfa1927d4d47ce50e6b965c3.tar.gz LegacyCamera-446b319606f90abedfa1927d4d47ce50e6b965c3.tar.bz2 |
Fix the wrong video duration in time lapse mode.
bug:3320235
Change-Id: I9532684b51f4a5091a27ea4d5a7d0e12d551fff1
Diffstat (limited to 'src/com/android/camera/VideoCamera.java')
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 137b4db..053b074 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -1222,6 +1222,9 @@ public class VideoCamera extends NoSearchActivity new File(mCurrentVideoFilename).length()); long duration = SystemClock.uptimeMillis() - mRecordingStartTime; if (duration > 0) { + if (mCaptureTimeLapse) { + duration = getTimeLapseVideoLength(duration); + } mCurrentVideoValues.put(Video.Media.DURATION, duration); } else { Log.w(TAG, "Video duration <= 0 : " + duration); @@ -1637,15 +1640,11 @@ public class VideoCamera extends NoSearchActivity return timeStringBuilder.toString(); } - // Calculates the time lapse video length till now and returns it in - // the format hh:mm:ss.dd, where dd are the centi seconds. - private String getTimeLapseVideoLengthString(long deltaMs) { + private long getTimeLapseVideoLength(long deltaMs) { // For better approximation calculate fractional number of frames captured. // This will update the video time at a higher resolution. double numberOfFrames = (double) deltaMs / mTimeBetweenTimeLapseFrameCaptureMs; - long videoTimeMs = - (long) (numberOfFrames / (double) mProfile.videoFrameRate * 1000); - return millisecondToTimeString(videoTimeMs, true); + return (long) (numberOfFrames / (double) mProfile.videoFrameRate * 1000); } private void updateRecordingTime() { @@ -1671,8 +1670,8 @@ public class VideoCamera extends NoSearchActivity } else { // The length of time lapse video is different from the length // of the actual wall clock time elapsed. Display the video length - // only. - text = getTimeLapseVideoLengthString(delta); + // only in format hh:mm:ss.dd, where dd are the centi seconds. + text = millisecondToTimeString(getTimeLapseVideoLength(delta), true); } mRecordingTimeView.setText(text); |