Bug 1035531 - Discard buffer instead of assert if camera media frame comes in early. r=mikeh, a=2.0+
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 09 Jul 2014 07:04:00 +0200
changeset 208025 e52bc38eac66a423c73649981f134d8fd6b2c36a
parent 208024 2f78fcbe409e5e9a930d45ffe63750099afe08da
child 208026 e12c32a65348691eb88f4f5ca88127eb0b8ffa24
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikeh, 2
bugs1035531
milestone32.0a2
Bug 1035531 - Discard buffer instead of assert if camera media frame comes in early. r=mikeh, a=2.0+
dom/camera/GonkCameraSource.cpp
--- a/dom/camera/GonkCameraSource.cpp
+++ b/dom/camera/GonkCameraSource.cpp
@@ -700,17 +700,22 @@ void GonkCameraSource::dataCallbackTimes
         Mutex::Autolock autoLock(mLock);
         if (!mStarted || (mNumFramesReceived == 0 && timestampUs < mStartTimeUs)) {
             CS_LOGV("Drop frame at %lld/%lld us", timestampUs, mStartTimeUs);
             releaseOneRecordingFrame(data);
             return;
         }
 
         if (mNumFramesReceived > 0) {
-            CHECK(timestampUs > mLastFrameTimestampUs);
+            if (timestampUs <= mLastFrameTimestampUs) {
+                CS_LOGE("Drop frame at %lld us, before last at %lld us",
+                    timestampUs, mLastFrameTimestampUs);
+                releaseOneRecordingFrame(data);
+                return;
+            }
             if (timestampUs - mLastFrameTimestampUs > mGlitchDurationThresholdUs) {
                 ++mNumGlitches;
             }
         }
 
         // May need to skip frame or modify timestamp. Currently implemented
         // by the subclass CameraSourceTimeLapse.
         if (skipCurrentFrame(timestampUs)) {