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 209109 e52bc38eac66a423c73649981f134d8fd6b2c36a
parent 209108 2f78fcbe409e5e9a930d45ffe63750099afe08da
child 209110 e12c32a65348691eb88f4f5ca88127eb0b8ffa24
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [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)) {