Bug 1205470 - [MSE] Remove assertion. r=cpearce, a=sylvestre
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 21 Sep 2015 12:28:56 +1000
changeset 296159 9d1337291612178ddbbdcb82b272fe7414fbbda8
parent 296158 e7b899c144c9cac4ddc6c574c270db75e811394c
child 296160 a3e1dc60e200004de0df58c8215736d2961c85c9
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, sylvestre
bugs1205470
milestone43.0a2
Bug 1205470 - [MSE] Remove assertion. r=cpearce, a=sylvestre Can also remove mInitDone member as that information is redundant with the init promise being present
dom/media/mediasource/MediaSourceDemuxer.cpp
dom/media/mediasource/MediaSourceDemuxer.h
--- a/dom/media/mediasource/MediaSourceDemuxer.cpp
+++ b/dom/media/mediasource/MediaSourceDemuxer.cpp
@@ -22,17 +22,16 @@ using media::TimeIntervals;
 // Gap allowed between frames. Due to inaccuracies in determining buffer end
 // frames (Bug 1065207). This value is based on the end of frame
 // default value used in Blink, kDefaultBufferDurationInMs.
 #define EOS_FUZZ_US 125000
 
 MediaSourceDemuxer::MediaSourceDemuxer()
   : mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
                              /* aSupportsTailDispatch = */ true))
-  , mInitDone(false)
   , mMonitor("MediaSourceDemuxer")
 {
   MOZ_ASSERT(NS_IsMainThread());
 }
 
 nsRefPtr<MediaSourceDemuxer::InitPromise>
 MediaSourceDemuxer::Init()
 {
@@ -41,36 +40,33 @@ MediaSourceDemuxer::Init()
 }
 
 nsRefPtr<MediaSourceDemuxer::InitPromise>
 MediaSourceDemuxer::AttemptInit()
 {
   MOZ_ASSERT(OnTaskQueue());
 
   if (ScanSourceBuffersForContent()) {
-    mInitDone = true;
     return InitPromise::CreateAndResolve(NS_OK, __func__);
   }
 
   nsRefPtr<InitPromise> p = mInitPromise.Ensure(__func__);
 
   return p;
 }
 
 void MediaSourceDemuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
 {
   nsRefPtr<MediaSourceDemuxer> self = this;
   nsCOMPtr<nsIRunnable> task =
     NS_NewRunnableFunction([self] () {
-      if (self->mInitDone) {
+      if (self->mInitPromise.IsEmpty()) {
         return;
       }
-      MOZ_ASSERT(!self->mInitPromise.IsEmpty());
       if (self->ScanSourceBuffersForContent()) {
-        self->mInitDone = true;
         self->mInitPromise.ResolveIfExists(NS_OK, __func__);
       }
     });
   GetTaskQueue()->Dispatch(task.forget());
 }
 
 bool
 MediaSourceDemuxer::ScanSourceBuffersForContent()
--- a/dom/media/mediasource/MediaSourceDemuxer.h
+++ b/dom/media/mediasource/MediaSourceDemuxer.h
@@ -69,17 +69,16 @@ private:
   }
 
   RefPtr<TaskQueue> mTaskQueue;
   nsTArray<nsRefPtr<MediaSourceTrackDemuxer>> mDemuxers;
 
   nsTArray<nsRefPtr<TrackBuffersManager>> mSourceBuffers;
 
   MozPromiseHolder<InitPromise> mInitPromise;
-  bool mInitDone;
 
   // Monitor to protect members below across multiple threads.
   mutable Monitor mMonitor;
   nsRefPtr<TrackBuffersManager> mAudioTrack;
   nsRefPtr<TrackBuffersManager> mVideoTrack;
   MediaInfo mInfo;
 };