Bug 1141781 - Grip the VideoFrameContainer when queing a call to invalidate in the MediaStreamGraph. r=roc, a=lsblakk
💩💩 backed out by 6a9120be7216 💩 💩
authorPaul Adenot <paul@paul.cx>
Mon, 16 Mar 2015 18:12:36 +0100
changeset 250424 6a4e68222995
parent 250423 f4c0cec35772
child 250425 067f83e99f66
push id4583
push userryanvm@gmail.com
push date2015-03-18 16:53 +0000
treeherdermozilla-beta@067f83e99f66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs1141781
milestone37.0
Bug 1141781 - Grip the VideoFrameContainer when queing a call to invalidate in the MediaStreamGraph. r=roc, a=lsblakk
dom/media/MediaStreamGraph.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1071,16 +1071,33 @@ SetImageToBlackPixel(PlanarYCbCrImage* a
   data.mYChannel = blackPixel;
   data.mCbChannel = blackPixel + 1;
   data.mCrChannel = blackPixel + 2;
   data.mYStride = data.mCbCrStride = 1;
   data.mPicSize = data.mYSize = data.mCbCrSize = IntSize(1, 1);
   aImage->SetData(data);
 }
 
+class VideoFrameContainerInvalidateRunnable : public nsRunnable {
+public:
+  explicit VideoFrameContainerInvalidateRunnable(VideoFrameContainer* aVideoFrameContainer)
+    : mVideoFrameContainer(aVideoFrameContainer)
+  {}
+  NS_IMETHOD Run()
+  {
+    MOZ_ASSERT(NS_IsMainThread());
+
+    mVideoFrameContainer->Invalidate();
+
+    return NS_OK;
+  }
+private:
+  nsRefPtr<VideoFrameContainer> mVideoFrameContainer;
+};
+
 void
 MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
 {
   MOZ_ASSERT(mRealtime, "Should only attempt to play video in realtime mode");
 
   if (aStream->mVideoOutputs.IsEmpty())
     return;
 
@@ -1134,17 +1151,17 @@ MediaStreamGraphImpl::PlayVideo(MediaStr
       output->SetCurrentFrame(frame->GetIntrinsicSize(), image,
                               targetTime);
     } else {
       output->SetCurrentFrame(frame->GetIntrinsicSize(), frame->GetImage(),
                               targetTime);
     }
 
     nsCOMPtr<nsIRunnable> event =
-      NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
+      new VideoFrameContainerInvalidateRunnable(output);
     DispatchToMainThreadAfterStreamStateUpdate(event.forget());
   }
   if (!aStream->mNotifiedFinished) {
     aStream->mLastPlayedVideoFrame = *frame;
   }
 }
 
 bool
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -562,22 +562,22 @@ void MediaPipelineTransmit::AttachToTrac
 
   // TODO(ekr@rtfm.com): Check for errors
   MOZ_MTLOG(ML_DEBUG, "Attaching pipeline to stream "
             << static_cast<void *>(stream_) << " conduit type=" <<
             (conduit_->type() == MediaSessionConduit::AUDIO ?"audio":"video"));
 
   stream_->AddListener(listener_);
 
-  // Is this a gUM mediastream?  If so, also register the Listener directly with
-  // the SourceMediaStream that's attached to the TrackUnion so we can get direct
-  // unqueued (and not resampled) data
-  if (domstream_->AddDirectListener(listener_)) {
-    listener_->direct_connect_ = true;
-  }
+ // // Is this a gUM mediastream?  If so, also register the Listener directly with
+ // // the SourceMediaStream that's attached to the TrackUnion so we can get direct
+ // // unqueued (and not resampled) data
+ // if (domstream_->AddDirectListener(listener_)) {
+ //   listener_->direct_connect_ = true;
+ // }
 
 #ifndef MOZILLA_INTERNAL_API
   // this enables the unit tests that can't fiddle with principals and the like
   listener_->SetEnabled(true);
 #endif
 }
 
 #ifdef MOZILLA_INTERNAL_API