Bug 1206708 - Make all WebRTC ImageContainers async. r=jesup,nical
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 11 Apr 2016 16:13:26 +0200
changeset 338345 08f50e080cdde2cc75b20d67e80a58ea50e68159
parent 338344 df7f2d705931bca6acc148954e524751beea120f
child 338346 13f36f3e31812f9c3787da944f4358c43b017160
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, nical
bugs1206708
milestone49.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 1206708 - Make all WebRTC ImageContainers async. r=jesup,nical This avoids expensive copying when compositing these frames on e10s. MozReview-Commit-ID: LIeUhh6rjCf
dom/media/VideoSegment.cpp
dom/media/webrtc/MediaEngineDefault.cpp
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
dom/media/webrtc/MediaEngineTabVideoSource.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
--- a/dom/media/VideoSegment.cpp
+++ b/dom/media/VideoSegment.cpp
@@ -41,17 +41,18 @@ VideoFrame::TakeFrom(VideoFrame* aFrame)
   mIntrinsicSize = aFrame->mIntrinsicSize;
   mForceBlack = aFrame->GetForceBlack();
   mPrincipalHandle = aFrame->mPrincipalHandle;
 }
 
 /* static */ already_AddRefed<Image>
 VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
 {
-  RefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
+  RefPtr<ImageContainer> container =
+    LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
   RefPtr<PlanarYCbCrImage> image = container->CreatePlanarYCbCrImage();
   if (!image) {
     MOZ_ASSERT(false);
     return nullptr;
   }
 
   int len = ((aSize.width * aSize.height) * 3 / 2);
 
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -44,17 +44,18 @@ NS_IMPL_ISUPPORTS(MediaEngineDefaultVide
  */
 
 MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
   : MediaEngineVideoSource(kReleased)
   , mTimer(nullptr)
   , mMonitor("Fake video")
   , mCb(16), mCr(16)
 {
-  mImageContainer = layers::LayerManager::CreateImageContainer();
+  mImageContainer =
+    layers::LayerManager::CreateImageContainer(layers::ImageContainer::ASYNCHRONOUS);
 }
 
 MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource()
 {}
 
 void
 MediaEngineDefaultVideoSource::GetName(nsAString& aName)
 {
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -185,17 +185,18 @@ MediaEngineRemoteVideoSource::Start(Sour
     MOZ_ASSERT(mSources.Length() == mPrincipalHandles.Length());
   }
 
   aStream->AddTrack(aID, 0, new VideoSegment(), SourceMediaStream::ADDTRACK_QUEUED);
 
   if (mState == kStarted) {
     return NS_OK;
   }
-  mImageContainer = layers::LayerManager::CreateImageContainer();
+  mImageContainer =
+    layers::LayerManager::CreateImageContainer(layers::ImageContainer::ASYNCHRONOUS);
 
   mState = kStarted;
   mTrackID = aID;
 
   if (mozilla::camera::GetChildAndCall(
     &mozilla::camera::CamerasChild::StartCapture,
     mCapEngine, mCaptureIndex, mCapability, this)) {
     LOG(("StartCapture failed"));
--- a/dom/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -283,17 +283,18 @@ MediaEngineTabVideoSource::Draw() {
       docshell->GetPresContext(getter_AddRefs(presContext));
     }
     if (!presContext) {
       return;
     }
     presShell = presContext->PresShell();
   }
 
-  RefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
+  RefPtr<layers::ImageContainer> container =
+    layers::LayerManager::CreateImageContainer(layers::ImageContainer::ASYNCHRONOUS);
   RefPtr<DrawTarget> dt =
     Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                      mData.get(),
                                      size,
                                      stride,
                                      SurfaceFormat::B8G8R8X8);
   if (!dt || !dt->IsValid()) {
     return;
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -2137,17 +2137,18 @@ public:
       height_(0),
 #if defined(MOZILLA_INTERNAL_API)
       image_container_(),
       image_(),
 #endif
       monitor_("Video PipelineListener")
   {
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
-    image_container_ = LayerManager::CreateImageContainer();
+    image_container_ =
+      LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS);
 #endif
   }
 
 
   // Implement MediaStreamListener
   void NotifyQueuedTrackChanges(MediaStreamGraph* graph, TrackID tid,
                                 StreamTime offset,
                                 uint32_t events,