Bug 1102665 - Invalidate stream video frames in the regular stream state event queue. r=roc
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 20 Nov 2014 19:10:00 +0100
changeset 241213 58bdcf852b1c2b4ae05be9c2cfed151613cd4c28
parent 241136 794b5fca57b02ec6d0e9275431b90262c6d962a1
child 241214 790f6eefaa6af564be8145a8b3fd2a9a4a587926
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1102665
milestone36.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 1102665 - Invalidate stream video frames in the regular stream state event queue. r=roc
dom/media/DOMMediaStream.cpp
dom/media/MediaStreamGraph.cpp
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -88,17 +88,17 @@ public:
                                         StreamTime aTrackOffset,
                                         uint32_t aTrackEvents,
                                         const MediaSegment& aQueuedMedia) MOZ_OVERRIDE
   {
     if (aTrackEvents & (TRACK_EVENT_CREATED | TRACK_EVENT_ENDED)) {
       nsRefPtr<TrackChange> runnable =
         new TrackChange(this, aID, aTrackOffset, aTrackEvents,
                         aQueuedMedia.GetType());
-      NS_DispatchToMainThread(runnable);
+      aGraph->DispatchToMainThreadAfterStreamStateUpdate(runnable.forget());
     }
   }
 
 private:
   // These fields may only be accessed on the main thread
   DOMMediaStream* mStream;
 };
 
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1131,17 +1131,17 @@ MediaStreamGraphImpl::PlayVideo(MediaStr
                               targetTime);
     } else {
       output->SetCurrentFrame(frame->GetIntrinsicSize(), frame->GetImage(),
                               targetTime);
     }
 
     nsCOMPtr<nsIRunnable> event =
       NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
-    NS_DispatchToMainThread(event);
+    DispatchToMainThreadAfterStreamStateUpdate(event.forget());
   }
   if (!aStream->mNotifiedFinished) {
     aStream->mLastPlayedVideoFrame = *frame;
   }
 }
 
 bool
 MediaStreamGraphImpl::ShouldUpdateMainThread()