Bug 1130913: Only create a new decoder if we have a new media segment. r=mattwoodrow
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 11 Feb 2015 17:40:10 +1100
changeset 255702 8d1478ae4bc8a17bd7fcbdee1d9d97aa8f1041bb
parent 255701 12295330cc7c37b61c7a93261e3432cebf5e01da
child 255703 d9437013657a452e61138f28a92534fed4392c03
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1130913
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1130913: Only create a new decoder if we have a new media segment. r=mattwoodrow
dom/media/mediasource/TrackBuffer.cpp
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -206,17 +206,17 @@ TrackBuffer::AppendData(LargeDataBuffer*
   } else if (!hadCompleteInitData && gotInit) {
     MOZ_ASSERT(mCurrentDecoder);
     // Queue pending decoder for initialization now that we have a full
     // init segment.
     decoders.AppendElement(mCurrentDecoder);
   }
 
   if (gotMedia) {
-    if (mLastEndTimestamp &&
+    if (mParser->IsMediaSegmentPresent(aData) && mLastEndTimestamp &&
         (!mParser->TimestampsFuzzyEqual(start, mLastEndTimestamp.value()) ||
          mLastTimestampOffset != aTimestampOffset ||
          mDecoderPerSegment ||
          (mCurrentDecoder && mCurrentDecoder->WasTrimmed()))) {
       MSE_DEBUG("TrackBuffer(%p)::AppendData: Data last=[%lld, %lld] overlaps [%lld, %lld]",
                 this, mLastStartTimestamp, mLastEndTimestamp.value(), start, end);
 
       if (!newInitData) {
@@ -251,21 +251,22 @@ TrackBuffer::AppendData(LargeDataBuffer*
     mInitializationPromise.Reject(NS_ERROR_FAILURE, __func__);
     return p;
   }
 
   if (decoders.Length()) {
     // We're going to have to wait for the decoder to initialize, the promise
     // will be resolved once initialization completes.
     return p;
-  } else if (gotMedia) {
-    // Tell our reader that we have more data to ensure that playback starts if
-    // required when data is appended.
-    mParentDecoder->GetReader()->MaybeNotifyHaveData();
   }
+
+  // Tell our reader that we have more data to ensure that playback starts if
+  // required when data is appended.
+  mParentDecoder->GetReader()->MaybeNotifyHaveData();
+
   mInitializationPromise.Resolve(gotMedia, __func__);
   return p;
 }
 
 bool
 TrackBuffer::AppendDataToCurrentResource(LargeDataBuffer* aData, uint32_t aDuration)
 {
   MOZ_ASSERT(NS_IsMainThread());