Bug 1189138: [MSE] P4. Tell the mediasource demuxer of modified range as early as possible. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 30 Jul 2015 14:32:31 +1000
changeset 287079 42a673cd36ff22cd916c05841cbd45adc03f0b16
parent 287078 ca2c0a7b3b3bf38abf606b9d315ea1d4d7b9046d
child 287080 759a1be250b9dc266adff552e0b43e34821fac26
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1189138
milestone42.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 1189138: [MSE] P4. Tell the mediasource demuxer of modified range as early as possible. r=gerald We would only tell our demuxer once a complete media segment had been received. A partial media append would have unnecessarily delayed pending seeks.
dom/media/mediasource/TrackBuffersManager.cpp
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -553,19 +553,16 @@ TrackBuffersManager::CodedFrameRemoval(T
   mSizeSourceBuffer = mVideoTracks.mSizeBuffer + mAudioTracks.mSizeBuffer;
 
   // 4. If buffer full flag equals true and this object is ready to accept more bytes, then set the buffer full flag to false.
   if (mBufferFull && mSizeSourceBuffer < mEvictionThreshold) {
     mBufferFull = false;
   }
   mEvictionOccurred = true;
 
-  // Tell our demuxer that data was removed.
-  mMediaSourceDemuxer->NotifyTimeRangesChanged();
-
   return dataRemoved;
 }
 
 void
 TrackBuffersManager::UpdateBufferedRanges()
 {
   MonitorAutoLock mon(mMonitor);
 
@@ -579,16 +576,19 @@ TrackBuffersManager::UpdateBufferedRange
   }
   if (HasAudio()) {
     MSE_DEBUG("after audio ranges=%s",
               DumpTimeRanges(mAudioTracks.mBufferedRanges).get());
   }
 #endif
 
   mOfficialGroupEndTimestamp = mGroupEndTimestamp;
+
+  // Tell our demuxer that data was removed or added.
+  mMediaSourceDemuxer->NotifyTimeRangesChanged();
 }
 
 nsRefPtr<TrackBuffersManager::AppendPromise>
 TrackBuffersManager::InitSegmentParserLoop()
 {
   MOZ_ASSERT(OnTaskQueue());
 
   MOZ_ASSERT(mAppendPromise.IsEmpty() && !mAppendRunning);
@@ -1191,19 +1191,16 @@ TrackBuffersManager::CompleteCodedFrameP
   // from the resource.
   mCurrentInputBuffer->EvictAll();
   mInputDemuxer->NotifyDataRemoved();
   RecreateParser();
 
   // 7. Set append state to WAITING_FOR_SEGMENT.
   SetAppendState(AppendState::WAITING_FOR_SEGMENT);
 
-  // Tell our demuxer that data was added.
-  mMediaSourceDemuxer->NotifyTimeRangesChanged();
-
   // 8. Jump to the loop top step above.
   ResolveProcessing(false, __func__);
 }
 
 void
 TrackBuffersManager::RejectProcessing(nsresult aRejectValue, const char* aName)
 {
   if (mAbort) {