Bug 1359668 - update mSettings.mWidth and mSettings.mHeight when there is a frame size change. r?jib draft
authorMunro Mengjue Chiang <mchiang@mozilla.com>
Fri, 28 Apr 2017 17:54:42 +0800
changeset 570061 a2ff7adaeac096188cecb42cf3568248ab053aae
parent 570046 84762dbeb5380461fe27f0afa0e27e8ba9dd3b01
child 626386 c2f239ecc774655e548557cfa3a89d0787596fb3
push id56376
push userbmo:mchiang@mozilla.com
push dateFri, 28 Apr 2017 09:54:59 +0000
reviewersjib
bugs1359668
milestone55.0a1
Bug 1359668 - update mSettings.mWidth and mSettings.mHeight when there is a frame size change. r?jib MozReview-Commit-ID: GGagmRai3YP
dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
--- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
@@ -351,16 +351,23 @@ MediaEngineRemoteVideoSource::FrameSizeC
 #if defined(MOZ_WIDGET_GONK)
   mMonitor.AssertCurrentThreadOwns(); // mWidth and mHeight are protected...
 #endif
   if ((mWidth < 0) || (mHeight < 0) ||
       (w !=  (unsigned int) mWidth) || (h != (unsigned int) mHeight)) {
     LOG(("MediaEngineRemoteVideoSource Video FrameSizeChange: %ux%u was %ux%u", w, h, mWidth, mHeight));
     mWidth = w;
     mHeight = h;
+
+    RefPtr<MediaEngineRemoteVideoSource> that = this;
+    NS_DispatchToMainThread(media::NewRunnableFrom([that, w, h]() mutable {
+      that->mSettings.mWidth.Value() = w;
+      that->mSettings.mHeight.Value() = h;
+      return NS_OK;
+    }));
   }
 }
 
 int
 MediaEngineRemoteVideoSource::DeliverFrame(uint8_t* aBuffer ,
                                     const camera::VideoFrameProperties& aProps)
 {
   // Check for proper state.