Browse Source

WebRTC backports

Ian Neal 5 months ago
parent
commit
3eac092612

+ 343 - 0
mozilla-release/patches/1394602-61a1.patch

@@ -0,0 +1,343 @@
+# HG changeset patch
+# User Nils Ohlmeier [:drno] <drno@ohlmeier.org>
+# Date 1512172497 28800
+# Node ID 9d5db4dacc58fe526ac7d4eb8cb757babad363bd
+# Parent  7613af7a7b4dd5d15dc8ebd0086576400e18f59a
+Bug 1394602: don't allow SSRC changes with Bundle. r=bwc
+
+MozReview-Commit-ID: Kgb0lghAY7r
+
+diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js
+--- a/dom/media/tests/mochitest/templates.js
++++ b/dom/media/tests/mochitest/templates.js
+@@ -478,17 +478,17 @@ function PC_LOCAL_REMOVE_RTCPMUX_FROM_OF
+ 
+ function PC_LOCAL_REMOVE_SSRC_FROM_OFFER(test) {
+   test.originalOffer.sdp = sdputils.removeSSRCs(test.originalOffer.sdp);
+   info("Updated no SSRCs offer: " + JSON.stringify(test.originalOffer));
+ };
+ 
+ function PC_REMOTE_REMOVE_SSRC_FROM_ANSWER(test) {
+   test.originalAnswer.sdp = sdputils.removeSSRCs(test.originalAnswer.sdp);
+-  info("Updated no SSRCs answer: " + JSON.stringify(test.originalAnswerr));
++  info("Updated no SSRCs answer: " + JSON.stringify(test.originalAnswer));
+ };
+ 
+ var addRenegotiation = (chain, commands, checks) => {
+   chain.append(commands);
+   chain.append(commandsPeerConnectionOfferAnswer);
+   if (checks) {
+     chain.append(checks);
+   }
+diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
+--- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
++++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
+@@ -379,16 +379,18 @@ public:
+    * Function to attach Renderer end-point of the Media-Video conduit.
+    * @param aRenderer : Reference to the concrete Video renderer implementation
+    * Note: Multiple invocations of this API shall remove an existing renderer
+    * and attaches the new to the Conduit.
+    */
+   virtual MediaConduitErrorCode AttachRenderer(RefPtr<mozilla::VideoRenderer> aRenderer) = 0;
+   virtual void DetachRenderer() = 0;
+ 
++  virtual void DisableSsrcChanges() = 0;
++
+   bool SetRemoteSSRC(unsigned int ssrc) override = 0;
+ 
+   /**
+    * Function to deliver a capture video frame for encoding and transport.
+    * If the frame's timestamp is 0, it will be automatcally generated.
+    *
+    * NOTE: ConfigureSendMediaCodec() must be called before this function can
+    *       be invoked. This ensures the inserted video-frames can be
+diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
++++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+@@ -269,16 +269,18 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
+   , mDenoising(false)
+   , mLockScaling(false)
+   , mSpatialLayers(1)
+   , mTemporalLayers(1)
+   , mCodecMode(webrtc::kRealtimeVideo)
+   , mCall(aCall) // refcounted store of the call object
+   , mSendStreamConfig(this) // 'this' is stored but not  dereferenced in the constructor.
+   , mRecvStreamConfig(this) // 'this' is stored but not  dereferenced in the constructor.
++  , mAllowSsrcChange(true)
++  , mWaitingForInitialSsrc(true)
+   , mRecvSSRC(0)
+   , mRecvSSRCSetInProgress(false)
+   , mSendCodecPlugin(nullptr)
+   , mRecvCodecPlugin(nullptr)
+   , mVideoStatsTimer(NS_NewTimer())
+ {
+   mRecvStreamConfig.renderer = this;
+ 
+@@ -873,33 +875,34 @@ WebrtcVideoConduit::ConfigureSendMediaCo
+   }
+ 
+   return condError;
+ }
+ 
+ bool
+ WebrtcVideoConduit::SetRemoteSSRC(unsigned int ssrc)
+ {
+-  CSFLogDebug(LOGTAG, "%s: SSRC %u (0x%x)", __FUNCTION__, ssrc, ssrc);
+-  mRecvStreamConfig.rtp.remote_ssrc = ssrc;
+-
+   unsigned int current_ssrc;
+   if (!GetRemoteSSRC(&current_ssrc)) {
+     return false;
+   }
+ 
+   if (current_ssrc == ssrc) {
+     return true;
+   }
+ 
+   bool wasReceiving = mEngineReceiving;
+   if (StopReceiving() != kMediaConduitNoError) {
+     return false;
+   }
+ 
++  CSFLogDebug(LOGTAG, "%s: SSRC %u (0x%x)", __FUNCTION__, ssrc, ssrc);
++  mRecvStreamConfig.rtp.remote_ssrc = ssrc;
++  mWaitingForInitialSsrc = false;
++
+   // This will destroy mRecvStream and create a new one (argh, why can't we change
+   // it without a full destroy?)
+   // We're going to modify mRecvStream, we must lock.  Only modified on MainThread.
+   // All non-MainThread users must lock before reading/using
+   {
+     MutexAutoLock lock(mCodecMutex);
+     // On the next StartReceiving() or ConfigureRecvMediaCodec, force
+     // building a new RecvStream to switch SSRCs.
+@@ -1964,86 +1967,88 @@ WebrtcVideoConduit::DeliverPacket(const 
+   }
+ 
+   return kMediaConduitNoError;
+ }
+ 
+ MediaConduitErrorCode
+ WebrtcVideoConduit::ReceivedRTPPacket(const void* data, int len, uint32_t ssrc)
+ {
+-  // Handle the unknown ssrc (and ssrc-not-signaled case).
+-  // We can't just do this here; it has to happen on MainThread :-(
+-  // We also don't want to drop the packet, nor stall this thread, so we hold
+-  // the packet (and any following) for inserting once the SSRC is set.
+-  bool queue = mRecvSSRCSetInProgress;
+-  if (queue || mRecvSSRC != ssrc) {
+-    // capture packet for insertion after ssrc is set -- do this before
+-    // sending the runnable, since it may pull from this.  Since it
+-    // dispatches back to us, it's less critial to do this here, but doesn't
+-    // hurt.
+-    UniquePtr<QueuedPacket> packet((QueuedPacket*) malloc(sizeof(QueuedPacket) + len-1));
+-    packet->mLen = len;
+-    memcpy(packet->mData, data, len);
+-    CSFLogDebug(LOGTAG, "queuing packet: seq# %u, Len %d ",
+-                (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
+-    if (queue) {
++  if (mAllowSsrcChange || mWaitingForInitialSsrc) {
++    // Handle the unknown ssrc (and ssrc-not-signaled case).
++    // We can't just do this here; it has to happen on MainThread :-(
++    // We also don't want to drop the packet, nor stall this thread, so we hold
++    // the packet (and any following) for inserting once the SSRC is set.
++    bool queue = mRecvSSRCSetInProgress;
++    if (queue || mRecvSSRC != ssrc) {
++      // capture packet for insertion after ssrc is set -- do this before
++      // sending the runnable, since it may pull from this.  Since it
++      // dispatches back to us, it's less critial to do this here, but doesn't
++      // hurt.
++      UniquePtr<QueuedPacket> packet((QueuedPacket*) malloc(sizeof(QueuedPacket) + len-1));
++      packet->mLen = len;
++      memcpy(packet->mData, data, len);
++      CSFLogDebug(LOGTAG, "queuing packet: seq# %u, Len %d ",
++                  (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
++      if (queue) {
++        mQueuedPackets.AppendElement(Move(packet));
++        return kMediaConduitNoError;
++      }
++      // a new switch needs to be done
++      // any queued packets are from a previous switch that hasn't completed
++      // yet; drop them and only process the latest SSRC
++      mQueuedPackets.Clear();
+       mQueuedPackets.AppendElement(Move(packet));
++
++      CSFLogDebug(LOGTAG, "%s: switching from SSRC %u to %u", __FUNCTION__,
++                  mRecvSSRC, ssrc);
++      // we "switch" here immediately, but buffer until the queue is released
++      mRecvSSRC = ssrc;
++      mRecvSSRCSetInProgress = true;
++      queue = true;
++
++      // Ensure lamba captures refs
++      RefPtr<WebrtcVideoConduit> self = this;
++      nsCOMPtr<nsIThread> thread;
++      if (NS_WARN_IF(NS_FAILED(NS_GetCurrentThread(getter_AddRefs(thread))))) {
++        return kMediaConduitRTPProcessingFailed;
++      }
++      NS_DispatchToMainThread(media::NewRunnableFrom([self, thread, ssrc]() mutable {
++            // Normally this is done in CreateOrUpdateMediaPipeline() for
++            // initial creation and renegotiation, but here we're rebuilding the
++            // Receive channel at a lower level.  This is needed whenever we're
++            // creating a GMPVideoCodec (in particular, H264) so it can communicate
++            // errors to the PC.
++            WebrtcGmpPCHandleSetter setter(self->mPCHandle);
++            self->SetRemoteSSRC(ssrc); // this will likely re-create the VideoReceiveStream
++            // We want to unblock the queued packets on the original thread
++            thread->Dispatch(media::NewRunnableFrom([self, ssrc]() mutable {
++                  if (ssrc == self->mRecvSSRC) {
++                    // SSRC is set; insert queued packets
++                    for (auto& packet : self->mQueuedPackets) {
++                      CSFLogDebug(LOGTAG, "Inserting queued packets: seq# %u, Len %d ",
++                                  (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
++
++                      if (self->DeliverPacket(packet->mData, packet->mLen) != kMediaConduitNoError) {
++                        CSFLogError(LOGTAG, "%s RTP Processing Failed", __FUNCTION__);
++                        // Keep delivering and then clear the queue
++                      }
++                    }
++                    self->mQueuedPackets.Clear();
++                    // we don't leave inprogress until there are no changes in-flight
++                    self->mRecvSSRCSetInProgress = false;
++                  }
++                  // else this is an intermediate switch; another is in-flight
++
++                  return NS_OK;
++                }), NS_DISPATCH_NORMAL);
++            return NS_OK;
++          }));
+       return kMediaConduitNoError;
+     }
+-    // a new switch needs to be done
+-    // any queued packets are from a previous switch that hasn't completed
+-    // yet; drop them and only process the latest SSRC
+-    mQueuedPackets.Clear();
+-    mQueuedPackets.AppendElement(Move(packet));
+-
+-    CSFLogDebug(LOGTAG, "%s: switching from SSRC %u to %u", __FUNCTION__,
+-                mRecvSSRC, ssrc);
+-    // we "switch" here immediately, but buffer until the queue is released
+-    mRecvSSRC = ssrc;
+-    mRecvSSRCSetInProgress = true;
+-    queue = true;
+-
+-    // Ensure lamba captures refs
+-    RefPtr<WebrtcVideoConduit> self = this;
+-    nsCOMPtr<nsIThread> thread;
+-    if (NS_WARN_IF(NS_FAILED(NS_GetCurrentThread(getter_AddRefs(thread))))) {
+-      return kMediaConduitRTPProcessingFailed;
+-    }
+-    NS_DispatchToMainThread(media::NewRunnableFrom([self, thread, ssrc]() mutable {
+-          // Normally this is done in CreateOrUpdateMediaPipeline() for
+-          // initial creation and renegotiation, but here we're rebuilding the
+-          // Receive channel at a lower level.  This is needed whenever we're
+-          // creating a GMPVideoCodec (in particular, H264) so it can communicate
+-          // errors to the PC.
+-          WebrtcGmpPCHandleSetter setter(self->mPCHandle);
+-          self->SetRemoteSSRC(ssrc); // this will likely re-create the VideoReceiveStream
+-          // We want to unblock the queued packets on the original thread
+-          thread->Dispatch(media::NewRunnableFrom([self, ssrc]() mutable {
+-                if (ssrc == self->mRecvSSRC) {
+-                  // SSRC is set; insert queued packets
+-                  for (auto& packet : self->mQueuedPackets) {
+-                    CSFLogDebug(LOGTAG, "Inserting queued packets: seq# %u, Len %d ",
+-                                (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
+-
+-                    if (self->DeliverPacket(packet->mData, packet->mLen) != kMediaConduitNoError) {
+-                      CSFLogError(LOGTAG, "%s RTP Processing Failed", __FUNCTION__);
+-                      // Keep delivering and then clear the queue
+-                    }
+-                  }
+-                  self->mQueuedPackets.Clear();
+-                  // we don't leave inprogress until there are no changes in-flight
+-                  self->mRecvSSRCSetInProgress = false;
+-                }
+-                // else this is an intermediate switch; another is in-flight
+-
+-                return NS_OK;
+-              }), NS_DISPATCH_NORMAL);
+-          return NS_OK;
+-        }));
+-    return kMediaConduitNoError;
+   }
+ 
+   CSFLogVerbose(LOGTAG, "%s: seq# %u, Len %d, SSRC %u (0x%x) ", __FUNCTION__,
+                 (uint16_t)ntohs(((uint16_t*) data)[1]), len,
+                 (uint32_t) ntohl(((uint32_t*) data)[2]),
+                 (uint32_t) ntohl(((uint32_t*) data)[2]));
+ 
+   if (DeliverPacket(data, len) != kMediaConduitNoError) {
+diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.h b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h
++++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+@@ -305,16 +305,20 @@ public:
+                              uint64_t* bytesReceived,
+                              uint32_t* cumulativeLost,
+                              int32_t* rttMs) override;
+   bool GetRTCPSenderReport(DOMHighResTimeStamp* timestamp,
+                            unsigned int* packetsSent,
+                            uint64_t* bytesSent) override;
+   uint64_t MozVideoLatencyAvg();
+ 
++  void DisableSsrcChanges() override {
++    mAllowSsrcChange = false;
++  }
++
+ private:
+   // Don't allow copying/assigning.
+   WebrtcVideoConduit(const WebrtcVideoConduit&) = delete;
+   void operator=(const WebrtcVideoConduit&) = delete;
+ 
+   /** Shared statistics for receive and transmit video streams
+    */
+   class StreamStatistics {
+@@ -532,16 +536,20 @@ private:
+   // WEBRTC.ORG Call API
+   RefPtr<WebRtcCallWrapper> mCall;
+ 
+   webrtc::VideoSendStream::Config mSendStreamConfig;
+   VideoEncoderConfigBuilder mEncoderConfig;
+ 
+   webrtc::VideoReceiveStream::Config mRecvStreamConfig;
+ 
++  // Are SSRC changes without signaling allowed or not
++  bool mAllowSsrcChange;
++  bool mWaitingForInitialSsrc;
++
+   // accessed on creation, and when receiving packets
+   uint32_t mRecvSSRC; // this can change during a stream!
+ 
+   // The runnable to set the SSRC is in-flight; queue packets until it's done.
+   bool mRecvSSRCSetInProgress;
+   struct QueuedPacket {
+     int mLen;
+     uint8_t mData[1];
+diff --git a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+--- a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
++++ b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+@@ -858,16 +858,25 @@ TransceiverImpl::UpdateVideoConduit()
+   // for the remote_ssrc that will be used by the far-end sender.
+   if (!mJsepTransceiver->mRecvTrack.GetSsrcs().empty()) {
+     MOZ_MTLOG(ML_DEBUG, mPCHandle << "[" << mMid << "]: " << __FUNCTION__ <<
+               " Setting remote SSRC " <<
+               mJsepTransceiver->mRecvTrack.GetSsrcs().front());
+     conduit->SetRemoteSSRC(mJsepTransceiver->mRecvTrack.GetSsrcs().front());
+   }
+ 
++  // TODO (bug 1423041) once we pay attention to receiving MID's in RTP packets
++  // (see bug 1405495) we could make this depending on the presence of MID in
++  // the RTP packets instead of relying on the signaling.
++  if (mJsepTransceiver->HasBundleLevel() &&
++      (!mJsepTransceiver->mRecvTrack.GetNegotiatedDetails() ||
++       !mJsepTransceiver->mRecvTrack.GetNegotiatedDetails()->GetExt(webrtc::RtpExtension::kMIdUri))) {
++    conduit->DisableSsrcChanges();
++  }
++
+   if (mJsepTransceiver->mRecvTrack.GetNegotiatedDetails() &&
+       mJsepTransceiver->mRecvTrack.GetActive()) {
+     const auto& details(*mJsepTransceiver->mRecvTrack.GetNegotiatedDetails());
+ 
+     UpdateConduitRtpExtmap(details, LocalDirection::kRecv);
+ 
+     PtrVector<VideoCodecConfig> configs;
+     nsresult rv = NegotiatedDetailsToVideoCodecConfigs(details, &configs);

+ 31 - 0
mozilla-release/patches/1445860-61a1.patch

@@ -0,0 +1,31 @@
+# HG changeset patch
+# User Nils Ohlmeier [:drno] <drno@ohlmeier.org>
+# Date 1521085665 25200
+# Node ID 0665d23d7e8788a07048f1454ea4457c0197b9d0
+# Parent  503d14dfaf7c06a95376943288cbc2aa28280f59
+Bug 1445860: set PeerIdenity only on transmitting Transceivers. r=mt
+
+MozReview-Commit-ID: 10rKPDwuh9d
+
+diff --git a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+--- a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
++++ b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+@@ -119,17 +119,17 @@ TransceiverImpl::InitVideo()
+       mReceiveTrack);
+ }
+ 
+ nsresult
+ TransceiverImpl::UpdateSinkIdentity(const dom::MediaStreamTrack* aTrack,
+                                     nsIPrincipal* aPrincipal,
+                                     const PeerIdentity* aSinkIdentity)
+ {
+-  if (mJsepTransceiver->IsStopped()) {
++  if (!(mJsepTransceiver->mJsDirection & sdp::kSend)) {
+     return NS_OK;
+   }
+ 
+   mTransmitPipeline->UpdateSinkIdentity_m(aTrack, aPrincipal, aSinkIdentity);
+   return NS_OK;
+ }
+ 
+ void

+ 181 - 0
mozilla-release/patches/1458020-3-62a1.patch

@@ -0,0 +1,181 @@
+# HG changeset patch
+# User Jim Chen <nchen@mozilla.com>
+# Date 1526652964 14400
+# Node ID 30cb8d1f3fd315680c84b3af9daa03f2675fac55
+# Parent  b7f5595e8d3371994887bda8b88b0bf9bb00e3de
+Bug 1458020 - 3. Set JavaVM when actually using video capture; r=jib
+
+We currently set the Android JavaVM pointer in MediaEngineWebRTC.
+However, because of that, we end up setting the pointer in the child
+process, even though we really want to set the pointer in the parent
+process because that's where the camera will be accessed.
+
+This patch makes us set JavaVM inside VideoEngine itself, where we
+actually access the camera in the parent process.
+
+MozReview-Commit-ID: 3TeLiiK2vyh
+
+diff --git a/dom/media/systemservices/VideoEngine.cpp b/dom/media/systemservices/VideoEngine.cpp
+--- a/dom/media/systemservices/VideoEngine.cpp
++++ b/dom/media/systemservices/VideoEngine.cpp
+@@ -6,32 +6,36 @@
+ 
+ #include "VideoEngine.h"
+ #include "webrtc/video_engine/browser_capture_impl.h"
+ #include "webrtc/system_wrappers/include/clock.h"
+ #ifdef WEBRTC_ANDROID
+ #include "webrtc/modules/video_capture/video_capture.h"
+ #endif
+ 
++#ifdef MOZ_WIDGET_ANDROID
++#include "mozilla/jni/Utils.h"
++#endif
+ 
+ namespace mozilla {
+ namespace camera {
+ 
+ #undef LOG
+ #undef LOG_ENABLED
+ mozilla::LazyLogModule gVideoEngineLog("VideoEngine");
+ #define LOG(args) MOZ_LOG(gVideoEngineLog, mozilla::LogLevel::Debug, args)
+ #define LOG_ENABLED() MOZ_LOG_TEST(gVideoEngineLog, mozilla::LogLevel::Debug)
+ 
+ int VideoEngine::sId = 0;
+ #if defined(ANDROID)
+-int VideoEngine::SetAndroidObjects(JavaVM* javaVM) {
++int VideoEngine::SetAndroidObjects() {
+   LOG((__PRETTY_FUNCTION__));
+ 
+-  if (webrtc::SetCaptureAndroidVM(javaVM) != 0) {
++  JavaVM* const javaVM = mozilla::jni::GetVM();
++  if (!javaVM || webrtc::SetCaptureAndroidVM(javaVM) != 0) {
+     LOG(("Could not set capture Android VM"));
+     return -1;
+   }
+ #ifdef WEBRTC_INCLUDE_INTERNAL_VIDEO_RENDER
+   if (webrtc::SetRenderAndroidVM(javaVM) != 0) {
+     LOG(("Could not set render Android VM"));
+     return -1;
+   }
+@@ -157,16 +161,22 @@ VideoEngine::GetOrCreateVideoCaptureDevi
+    LOG(("Fetched current time of: %" PRId64, currentTime));
+   }
+   mExpiryTimeInMs = currentTime + kCacheExpiryPeriodMs;
+   LOG(("new device cache expiration is %" PRId64, mExpiryTimeInMs));
+   LOG(("creating a new VideoCaptureDeviceInfo of type %s", capDevTypeName));
+ 
+   switch (mCaptureDevInfo.type) {
+     case webrtc::CaptureDeviceType::Camera: {
++#ifdef MOZ_WIDGET_ANDROID
++      if (SetAndroidObjects()) {
++        LOG(("VideoEngine::SetAndroidObjects Failed"));
++        break;
++      }
++#endif
+       mDeviceInfo.reset(webrtc::VideoCaptureFactory::CreateDeviceInfo());
+       LOG(("webrtc::CaptureDeviceType::Camera: Finished creating new device."));
+       break;
+     }
+     case webrtc::CaptureDeviceType::Browser: {
+       mDeviceInfo.reset(webrtc::BrowserDeviceInfoImpl::CreateDeviceInfo());
+       LOG(("webrtc::CaptureDeviceType::Browser: Finished creating new device."));
+       break;
+diff --git a/dom/media/systemservices/VideoEngine.h b/dom/media/systemservices/VideoEngine.h
+--- a/dom/media/systemservices/VideoEngine.h
++++ b/dom/media/systemservices/VideoEngine.h
+@@ -32,17 +32,17 @@ private:
+   static const int64_t kCacheExpiryPeriodMs = 2000;
+ 
+ public:
+   VideoEngine (){};
+   NS_INLINE_DECL_REFCOUNTING(VideoEngine)
+ 
+   static already_AddRefed<VideoEngine> Create(UniquePtr<const webrtc::Config>&& aConfig);
+ #if defined(ANDROID)
+-  static int SetAndroidObjects(JavaVM* javaVM);
++  static int SetAndroidObjects();
+ #endif
+   void CreateVideoCapture(int32_t& id, const char* deviceUniqueIdUTF8);
+ 
+   int ReleaseVideoCapture(const int32_t id);
+ 
+   // VideoEngine is responsible for any cleanup in its modules
+   static void Delete(VideoEngine * engine) { }
+ 
+diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp
+--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
++++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
+@@ -14,21 +14,16 @@
+ #include "MediaTrackConstraints.h"
+ #include "mozilla/Logging.h"
+ #include "nsIComponentRegistrar.h"
+ #include "nsIPrefService.h"
+ #include "nsIPrefBranch.h"
+ #include "nsITabSource.h"
+ #include "prenv.h"
+ 
+-#ifdef MOZ_WIDGET_ANDROID
+-#include "AndroidBridge.h"
+-#include "VideoEngine.h"
+-#endif
+-
+ static mozilla::LazyLogModule sGetUserMediaLog("GetUserMedia");
+ #undef LOG
+ #define LOG(args) MOZ_LOG(sGetUserMediaLog, mozilla::LogLevel::Debug, args)
+ 
+ namespace mozilla {
+ 
+ // statics from AudioInputCubeb
+ nsTArray<int>* AudioInputCubeb::mDeviceIndexes;
+@@ -134,27 +129,16 @@ MediaEngineWebRTC::EnumerateDevices(uint
+                                     nsTArray<RefPtr<MediaEngineSource> >* aSources)
+ {
+   if (MediaEngineSource::IsVideo(aMediaSource)) {
+     // We spawn threads to handle gUM runnables, so we must protect the member vars
+     MutexAutoLock lock(mMutex);
+ 
+     mozilla::camera::CaptureEngine capEngine = mozilla::camera::InvalidEngine;
+ 
+-#ifdef MOZ_WIDGET_ANDROID
+-    // get the JVM
+-    JavaVM* jvm;
+-    JNIEnv* const env = jni::GetEnvForThread();
+-    MOZ_ALWAYS_TRUE(!env->GetJavaVM(&jvm));
+-
+-    if (!jvm || mozilla::camera::VideoEngine::SetAndroidObjects(jvm)) {
+-      LOG(("VideoEngine::SetAndroidObjects Failed"));
+-      return;
+-    }
+-#endif
+     bool scaryKind = false; // flag sources with cross-origin exploit potential
+ 
+     switch (aMediaSource) {
+       case dom::MediaSourceEnum::Window:
+         capEngine = mozilla::camera::WinEngine;
+         break;
+       case dom::MediaSourceEnum::Application:
+         capEngine = mozilla::camera::AppEngine;
+diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
++++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+@@ -1184,19 +1184,17 @@ WebrtcVideoConduit::InitMain()
+       }
+       Unused << NS_WARN_IF(NS_FAILED(branch->GetBoolPref(
+         "media.peerconnection.video.denoising", &mDenoising)));
+       Unused << NS_WARN_IF(NS_FAILED(branch->GetBoolPref(
+         "media.peerconnection.video.lock_scaling", &mLockScaling)));
+     }
+   }
+ #ifdef MOZ_WIDGET_ANDROID
+-  JavaVM* jvm = mozilla::jni::GetVM();
+-
+-  if (mozilla::camera::VideoEngine::SetAndroidObjects(jvm) != 0) {
++  if (mozilla::camera::VideoEngine::SetAndroidObjects() != 0) {
+     CSFLogError(LOGTAG,  "%s: could not set Android objects", __FUNCTION__);
+     return kMediaConduitSessionNotInited;
+   }
+ #endif  //MOZ_WIDGET_ANDROID
+   return kMediaConduitNoError;
+ }
+ 
+ /**

+ 26 - 26
mozilla-release/patches/1465585-3-std-62a1.patch

@@ -2,7 +2,7 @@
 # User Emilio Cobos Alvarez <emilio@crisal.io>
 # Date 1527707735 -7200
 # Node ID b54db66223586b4e04f5cb926fccdacf8a176b91
-# Parent  8ebbfcb10d53ab29e0aef88700e36f67aaa6b2a7
+# Parent  8e1edde418db43cf7b16fd2ac37b19485928d36b
 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
 
 This was done automatically replacing:
@@ -15770,7 +15770,7 @@ diff --git a/dom/media/systemservices/ShmemPool.h b/dom/media/systemservices/Shm
 diff --git a/dom/media/systemservices/VideoEngine.cpp b/dom/media/systemservices/VideoEngine.cpp
 --- a/dom/media/systemservices/VideoEngine.cpp
 +++ b/dom/media/systemservices/VideoEngine.cpp
-@@ -195,17 +195,17 @@ VideoEngine::GetConfiguration() {
+@@ -205,17 +205,17 @@ VideoEngine::GetConfiguration() {
  }
  
  already_AddRefed<VideoEngine>
@@ -43865,32 +43865,32 @@ diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signal
 diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
 +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
-@@ -1993,24 +1993,24 @@ WebrtcVideoConduit::ReceivedRTPPacket(co
-     // dispatches back to us, it's less critial to do this here, but doesn't
-     // hurt.
-     UniquePtr<QueuedPacket> packet((QueuedPacket*) malloc(sizeof(QueuedPacket) + len-1));
-     packet->mLen = len;
-     memcpy(packet->mData, data, len);
-     CSFLogDebug(LOGTAG, "queuing packet: seq# %u, Len %d ",
-                 (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
-     if (queue) {
+@@ -1995,24 +1995,24 @@ WebrtcVideoConduit::ReceivedRTPPacket(co
+       // dispatches back to us, it's less critial to do this here, but doesn't
+       // hurt.
+       UniquePtr<QueuedPacket> packet((QueuedPacket*) malloc(sizeof(QueuedPacket) + len-1));
+       packet->mLen = len;
+       memcpy(packet->mData, data, len);
+       CSFLogDebug(LOGTAG, "queuing packet: seq# %u, Len %d ",
+                   (uint16_t)ntohs(((uint16_t*) packet->mData)[1]), packet->mLen);
+       if (queue) {
+-        mQueuedPackets.AppendElement(Move(packet));
++        mQueuedPackets.AppendElement(std::move(packet));
+         return kMediaConduitNoError;
+       }
+       // a new switch needs to be done
+       // any queued packets are from a previous switch that hasn't completed
+       // yet; drop them and only process the latest SSRC
+       mQueuedPackets.Clear();
 -      mQueuedPackets.AppendElement(Move(packet));
 +      mQueuedPackets.AppendElement(std::move(packet));
-       return kMediaConduitNoError;
-     }
-     // a new switch needs to be done
-     // any queued packets are from a previous switch that hasn't completed
-     // yet; drop them and only process the latest SSRC
-     mQueuedPackets.Clear();
--    mQueuedPackets.AppendElement(Move(packet));
-+    mQueuedPackets.AppendElement(std::move(packet));
- 
-     CSFLogDebug(LOGTAG, "%s: switching from SSRC %u to %u", __FUNCTION__,
-                 mRecvSSRC, ssrc);
-     // we "switch" here immediately, but buffer until the queue is released
-     mRecvSSRC = ssrc;
-     mRecvSSRCSetInProgress = true;
-     queue = true;
+ 
+       CSFLogDebug(LOGTAG, "%s: switching from SSRC %u to %u", __FUNCTION__,
+                   mRecvSSRC, ssrc);
+       // we "switch" here immediately, but buffer until the queue is released
+       mRecvSSRC = ssrc;
+       mRecvSSRCSetInProgress = true;
+       queue = true;
  
 diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp

+ 56 - 0
mozilla-release/patches/1472321-63a1.patch

@@ -0,0 +1,56 @@
+# HG changeset patch
+# User Byron Campen [:bwc] <docfaraday@gmail.com>
+# Date 1531838607 18000
+# Node ID a3653576126828cb749dee9e63697563a6239c1f
+# Parent  45d8761b1e1024c18a69af5082ddf6e2a1ecb43d
+Bug 1472321: Make sure sink identity is set on recvonly/inactive transceivers. r=drno,mjf
+
+MozReview-Commit-ID: jZHsDKN5o6
+
+diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
++++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+@@ -1675,16 +1675,21 @@ MediaPipelineTransmit::UpdateSinkIdentit
+   if (aTrack != nullptr && aTrack != mDomTrack) {
+     // If a track is specified, then it might not be for this pipeline,
+     // since we receive notifications for all tracks on the PC.
+     // nullptr means that the PeerIdentity has changed and shall be applied
+     // to all tracks of the PC.
+     return;
+   }
+ 
++  if (!mDomTrack) {
++    // Nothing to do here
++    return;
++  }
++
+   bool enableTrack = aPrincipal->Subsumes(mDomTrack->GetPrincipal());
+   if (!enableTrack) {
+     // first try didn't work, but there's a chance that this is still available
+     // if our track is bound to a peerIdentity, and the peer connection (our
+     // sink) is bound to the same identity, then we can enable the track.
+     const PeerIdentity* trackIdentity = mDomTrack->GetPeerIdentity();
+     if (aSinkIdentity && trackIdentity) {
+       enableTrack = (*aSinkIdentity == *trackIdentity);
+diff --git a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+--- a/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
++++ b/media/webrtc/signaling/src/peerconnection/TransceiverImpl.cpp
+@@ -119,17 +119,17 @@ TransceiverImpl::InitVideo()
+       mReceiveTrack);
+ }
+ 
+ nsresult
+ TransceiverImpl::UpdateSinkIdentity(const dom::MediaStreamTrack* aTrack,
+                                     nsIPrincipal* aPrincipal,
+                                     const PeerIdentity* aSinkIdentity)
+ {
+-  if (!(mJsepTransceiver->mJsDirection & sdp::kSend)) {
++  if (mJsepTransceiver->IsStopped()) {
+     return NS_OK;
+   }
+ 
+   mTransmitPipeline->UpdateSinkIdentity_m(aTrack, aPrincipal, aSinkIdentity);
+   return NS_OK;
+ }
+ 
+ void

+ 69 - 0
mozilla-release/patches/1474661-63a1.patch

@@ -0,0 +1,69 @@
+# HG changeset patch
+# User Byron Campen [:bwc] <docfaraday@gmail.com>
+# Date 1532989647 0
+# Node ID 42aff55fb6d5ac0d02764fd7d18d530cd244f34f
+# Parent  45d8761b1e1024c18a69af5082ddf6e2a1ecb43d
+Bug 1474661: Fixed bug where we were overwriting the high quality simulcast config with the next one down, and add another entry to the resolutions/bitrates table. r=ng
+
+MozReview-Commit-ID: DhPYvioLqAe
+
+Differential Revision: https://phabricator.services.mozilla.com/D2480
+
+diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
++++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+@@ -597,17 +597,16 @@ WebrtcVideoConduit::VideoStreamFactory::
+ 
+   // XXX webrtc.org code has a restriction on simulcast layers that each
+   // layer must be 1/2 the dimension of the previous layer - not sure why.
+   // This means we can't use scaleResolutionBy/scaleDownBy (yet), even if
+   // the user specified it.  The one exception is that we can apply it on
+   // the full-resolution stream (which also happens to handle the
+   // non-simulcast usage case). NOTE: we make an assumption here, not in the
+   // spec, that the first stream is the full-resolution stream.
+-  auto& simulcastEncoding = mConduit->mCurSendCodecConfig->mSimulcastEncodings[0];
+ #if 0
+   // XXX What we'd like to do for each simulcast stream...
+   if (simulcastEncoding.constraints.scaleDownBy > 1.0) {
+     uint32_t new_width = width / simulcastEncoding.constraints.scaleDownBy;
+     uint32_t new_height = height / simulcastEncoding.constraints.scaleDownBy;
+ 
+     if (new_width != width || new_height != height) {
+       if (streamCount == 1) {
+@@ -634,17 +633,17 @@ WebrtcVideoConduit::VideoStreamFactory::
+ 
+     // width/height will be overridden on the first frame; they must be 'sane' for
+     // SetSendCodec()
+     video_stream.width = width >> idx;
+     video_stream.height = height >> idx;
+     // We want to ensure this picks up the current framerate, so indirect
+     video_stream.max_framerate = mConduit->mSendingFramerate;
+ 
+-    simulcastEncoding = mConduit->mCurSendCodecConfig->mSimulcastEncodings[idx];
++    auto& simulcastEncoding = mConduit->mCurSendCodecConfig->mSimulcastEncodings[idx];
+     MOZ_ASSERT(simulcastEncoding.constraints.scaleDownBy >= 1.0);
+ 
+     // Calculate these first
+     video_stream.max_bitrate_bps = MinIgnoreZero(simulcastEncoding.constraints.maxBr,
+                                                  kDefaultMaxBitrate_bps);
+     video_stream.max_bitrate_bps = MinIgnoreZero((int) mConduit->mPrefMaxBitrate*1000,
+                                                  video_stream.max_bitrate_bps);
+     video_stream.min_bitrate_bps = (mConduit->mMinBitrate ?
+@@ -1626,16 +1625,17 @@ struct ResolutionAndBitrateLimits
+ // 30fps.
+ 
+ // XXX Populate this based on a pref (which we should consider sorting because
+ // people won't assume they need to).
+ static ResolutionAndBitrateLimits kResolutionAndBitrateLimits[] = {
+   {MB_OF(1920, 1200), KBPS(1500), KBPS(2000), KBPS(10000)}, // >HD (3K, 4K, etc)
+   {MB_OF(1280, 720), KBPS(1200), KBPS(1500), KBPS(5000)}, // HD ~1080-1200
+   {MB_OF(800, 480), KBPS(600), KBPS(800), KBPS(2500)}, // HD ~720
++  {MB_OF(480, 270), KBPS(300), KBPS(500), KBPS(2000)},
+   {tl::Max<MB_OF(400, 240), MB_OF(352, 288)>::value, KBPS(200), KBPS(300), KBPS(1300)}, // VGA, WVGA
+   {MB_OF(176, 144), KBPS(100), KBPS(150), KBPS(500)}, // WQVGA, CIF
+   {0 , KBPS(40), KBPS(80), KBPS(250)} // QCIF and below
+ };
+ 
+ void
+ WebrtcVideoConduit::SelectBitrates(
+   unsigned short width, unsigned short height, int cap,

+ 3 - 4
mozilla-release/patches/1478685-60.patch → mozilla-release/patches/1478685-63a1.patch

@@ -1,10 +1,9 @@
 # HG changeset patch
 # User Byron Campen [:bwc] <docfaraday@gmail.com>
 # Date 1532620491 18000
-#      Thu Jul 26 10:54:51 2018 -0500
-# Node ID 098585dc86fc54509885626fc7dcf6c451e8d808
-# Parent  11462f2b98f268905a61eaf0278dd7cf208dc016
-Bug 1478685 - Set the RTP MID to the mid of the transceiver, not the transport id string. r=mjf, a=RyanVM
+# Node ID 56590b88c0412e04dd182a9500ba83bea8b86d13
+# Parent  5125854bd1257d2e87b401852c295c71b37b0b11
+Bug 1478685: Set the RTP MID to the mid of the transceiver, not the transport id string. r=mjf
 
 MozReview-Commit-ID: 30OrgQwpR8u
 

+ 24 - 29
mozilla-release/patches/1479853-60.patch → mozilla-release/patches/1479853-63a1.patch

@@ -1,10 +1,11 @@
 # HG changeset patch
 # User Byron Campen [:bwc] <docfaraday@gmail.com>
-# Date 1540557416 18000
-#      Fri Oct 26 07:36:56 2018 -0500
-# Node ID 4faeb696dd0609448e0a4b4d9add05519c6e4117
-# Parent  252625a277e904cec59dc9923ca693e1ce9fe0c4
-Bug 1479853 - Prevent more than one VideoConduit having the same remote SSRC. r=ng, a=RyanVM
+# Date 1533578935 0
+# Node ID 6eac5ca54df4bde67f0c0b88f16ff426969076ac
+# Parent  456b9d0f874bc73b47f4a600674f2a8895b52b9e
+Bug 1479853: Prevent more than one VideoConduit having the same remote SSRC. r=ng
+
+Differential Revision: https://phabricator.services.mozilla.com/D2738
 
 diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.h b/media/webrtc/signaling/src/media-conduit/AudioConduit.h
 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h
@@ -166,6 +167,10 @@ diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/
 +    return new WebRtcCallWrapper(std::move(aCall));
 +  }
 +
++  // Don't allow copying/assigning.
++  WebRtcCallWrapper(const WebRtcCallWrapper&) = delete;
++  void operator=(const WebRtcCallWrapper&) = delete;
++
 +  webrtc::Call* Call() const
 +  {
 +    return mCall.get();
@@ -220,10 +225,6 @@ diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/
 +    mCall = std::move(aCall);
 +  }
 +
-+  // Don't allow copying/assigning.
-+  WebRtcCallWrapper(const WebRtcCallWrapper&) = delete;
-+  void operator=(const WebRtcCallWrapper&) = delete;
-+
 +  UniquePtr<webrtc::Call> mCall;
 +  webrtc::RtcEventLogNullImpl mEventLog;
 +  // Allows conduits to know about one another, to avoid remote SSRC
@@ -239,14 +240,14 @@ diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/
  
    virtual uint64_t PluginID() const = 0;
  };
-@@ -382,16 +407,17 @@ public:
-    * @param aRenderer : Reference to the concrete Video renderer implementation
-    * Note: Multiple invocations of this API shall remove an existing renderer
+@@ -384,16 +409,17 @@ public:
     * and attaches the new to the Conduit.
     */
    virtual MediaConduitErrorCode AttachRenderer(RefPtr<mozilla::VideoRenderer> aRenderer) = 0;
    virtual void DetachRenderer() = 0;
  
+   virtual void DisableSsrcChanges() = 0;
+ 
    bool SetRemoteSSRC(unsigned int ssrc) override = 0;
 +  bool UnsetRemoteSSRC(uint32_t ssrc) override = 0;
  
@@ -260,9 +261,9 @@ diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/
 diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
 +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
-@@ -270,16 +270,17 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
-   , mSendStreamConfig(this) // 'this' is stored but not  dereferenced in the constructor.
-   , mRecvStreamConfig(this) // 'this' is stored but not  dereferenced in the constructor.
+@@ -272,16 +272,17 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
+   , mAllowSsrcChange(true)
+   , mWaitingForInitialSsrc(true)
    , mRecvSSRC(0)
    , mRecvSSRCSetInProgress(false)
    , mSendCodecPlugin(nullptr)
@@ -278,7 +279,7 @@ diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/w
      auto self = static_cast<WebrtcVideoConduit*>(aClosure);
      MutexAutoLock lock(self->mCodecMutex);
      if (self->mEngineTransmitting && self->mSendStream) {
-@@ -300,16 +301,17 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
+@@ -302,16 +303,17 @@ WebrtcVideoConduit::WebrtcVideoConduit(R
      callback, this, 1000, nsITimer::TYPE_REPEATING_PRECISE_CAN_SKIP,
      "WebrtcVideoConduit::WebrtcVideoConduit");
  }
@@ -296,7 +297,7 @@ diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/w
    }
  
    // Release AudioConduit first by dropping reference on MainThread, where it expects to be
-@@ -878,36 +880,57 @@ WebrtcVideoConduit::ConfigureSendMediaCo
+@@ -879,16 +881,32 @@ WebrtcVideoConduit::ConfigureSendMediaCo
        auto& simulcastEncoding = mCurSendCodecConfig->mSimulcastEncodings[idx-1];
        mSendStreamConfig.rtp.rids.push_back(simulcastEncoding.rid);
      }
@@ -324,16 +325,12 @@ diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/w
  bool
  WebrtcVideoConduit::SetRemoteSSRC(unsigned int ssrc)
  {
--  CSFLogDebug(LOGTAG, "%s: SSRC %u (0x%x)", __FUNCTION__, ssrc, ssrc);
--  mRecvStreamConfig.rtp.remote_ssrc = ssrc;
--
    unsigned int current_ssrc;
    if (!GetRemoteSSRC(&current_ssrc)) {
      return false;
    }
  
-   if (current_ssrc == ssrc) {
-     return true;
+@@ -897,16 +915,21 @@ WebrtcVideoConduit::SetRemoteSSRC(unsign
    }
  
    bool wasReceiving = mEngineReceiving;
@@ -341,23 +338,21 @@ diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/w
      return false;
    }
  
-+  CSFLogDebug(LOGTAG, "%s: SSRC %u (0x%x)", __FUNCTION__, ssrc, ssrc);
+   CSFLogDebug(LOGTAG, "%s: SSRC %u (0x%x)", __FUNCTION__, ssrc, ssrc);
 +  if (!mCall->UnsetRemoteSSRC(ssrc)) {
 +    CSFLogError(LOGTAG, "%s: Failed to unset SSRC %u (0x%x) on other conduits,"
 +                " bailing", __FUNCTION__, ssrc, ssrc);
 +    return false;
 +  }
-+  mRecvStreamConfig.rtp.remote_ssrc = ssrc;
-+
+   mRecvStreamConfig.rtp.remote_ssrc = ssrc;
+   mWaitingForInitialSsrc = false;
+ 
    // This will destroy mRecvStream and create a new one (argh, why can't we change
    // it without a full destroy?)
    // We're going to modify mRecvStream, we must lock.  Only modified on MainThread.
    // All non-MainThread users must lock before reading/using
    {
-     MutexAutoLock lock(mCodecMutex);
-     // On the next StartReceiving() or ConfigureRecvMediaCodec, force
-     // building a new RecvStream to switch SSRCs.
-@@ -920,16 +943,43 @@ WebrtcVideoConduit::SetRemoteSSRC(unsign
+@@ -922,16 +945,43 @@ WebrtcVideoConduit::SetRemoteSSRC(unsign
        CSFLogError(LOGTAG, "%s Start Receive Error %d ", __FUNCTION__, rval);
        return false;
      }

+ 34 - 0
mozilla-release/patches/1481725-63a1.patch

@@ -0,0 +1,34 @@
+# HG changeset patch
+# User Philipp Hancke <fippo@appear.in>
+# Date 1533809833 -7200
+# Node ID dc2b23ed78c70e50c44c6c1f9a07a8864647ecca
+# Parent  c6f8f280ef2ae62801c9e5c5bd1476be0d287829
+Bug 1481725: change minimum bitrate for VGA to 150kbps r=bwc
+
+and adapt min bitrate below that.
+Limits taken from the webrtc.org simulcast bitrate table.
+
+diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
++++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+@@ -1673,18 +1673,18 @@ struct ResolutionAndBitrateLimits
+ // 30fps.
+ 
+ // XXX Populate this based on a pref (which we should consider sorting because
+ // people won't assume they need to).
+ static ResolutionAndBitrateLimits kResolutionAndBitrateLimits[] = {
+   {MB_OF(1920, 1200), KBPS(1500), KBPS(2000), KBPS(10000)}, // >HD (3K, 4K, etc)
+   {MB_OF(1280, 720), KBPS(1200), KBPS(1500), KBPS(5000)}, // HD ~1080-1200
+   {MB_OF(800, 480), KBPS(600), KBPS(800), KBPS(2500)}, // HD ~720
+-  {MB_OF(480, 270), KBPS(300), KBPS(500), KBPS(2000)},
+-  {tl::Max<MB_OF(400, 240), MB_OF(352, 288)>::value, KBPS(200), KBPS(300), KBPS(1300)}, // VGA, WVGA
++  {MB_OF(480, 270), KBPS(150), KBPS(500), KBPS(2000)}, // WVGA
++  {tl::Max<MB_OF(400, 240), MB_OF(352, 288)>::value, KBPS(125), KBPS(300), KBPS(1300)}, // VGA
+   {MB_OF(176, 144), KBPS(100), KBPS(150), KBPS(500)}, // WQVGA, CIF
+   {0 , KBPS(40), KBPS(80), KBPS(250)} // QCIF and below
+ };
+ 
+ void
+ WebrtcVideoConduit::SelectBitrates(
+   unsigned short width, unsigned short height, int cap,
+   int32_t aLastFramerateTenths,

+ 8 - 2
mozilla-release/patches/series

@@ -3025,6 +3025,7 @@ NOBUG-20180313-inspector-61a1.patch
 1382581-6-61a1.patch
 1382581-7-61a1.patch
 1382581-8-61a1.patch
+1445860-61a1.patch
 1446254-61a1.patch
 1438839-1-61a1.patch
 1438839-2-61a1.patch
@@ -3358,6 +3359,7 @@ NOBUG-20180329-extensions-61a1.patch
 1450242-61a1.patch
 1449087-1-61a1.patch
 1450740-61a1.patch
+1394602-61a1.patch
 1443380-61a1.patch
 1083458-4-61a1.patch
 1083458-5-61a1.patch
@@ -3851,6 +3853,7 @@ NOBUG-20180505-lint-61a1.patch
 1462273-2-62a1.patch
 1461432-62a1.patch
 1420350-62a1.patch
+1458020-3-62a1.patch
 1462444-62a1.patch
 1237182-03-62a1.patch
 1455337-62a1.patch
@@ -4224,6 +4227,7 @@ NOBUG-20180505-lint-61a1.patch
 1478343-3-63a1.patch
 1478070-63a1.patch
 1477343-63a1.patch
+1478685-63a1.patch
 1478000-1-63a1.patch
 1476427-1-63a1.patch
 1476427-2-63a1.patch
@@ -4243,6 +4247,8 @@ NOBUG-20180505-lint-61a1.patch
 1478097-2-63a1.patch
 1472975-63a1.patch
 1465798-63a1.patch
+1472321-63a1.patch
+1474661-63a1.patch
 1409276-1-63a1.patch
 1409276-2-63a1.patch
 1409276-3-63a1.patch
@@ -4269,6 +4275,7 @@ NOBUG-20180505-lint-61a1.patch
 1479950-63a1.patch
 1480588-63a1.patch
 1481016-63a1.patch
+1479853-63a1.patch
 1481097-1-63a1.patch
 1481097-2-63a1.patch
 1481097-3-63a1.patch
@@ -4303,6 +4310,7 @@ NOBUG-20180505-lint-61a1.patch
 1482841-2-63a1.patch
 1482605-63a1.patch
 1469287-63a1.patch
+1481725-63a1.patch
 1481441-63a1.patch
 1482695-63a1.patch
 1479878-63a1.patch
@@ -4586,7 +4594,6 @@ NOBUG-20180824-buildsetting-63a1.patch
 1491132-64a1.patch
 1492365-64a1.patch
 1486086-64a1.patch
-1478685-60.patch
 1487811-1-64a1.patch
 1487811-2-64a1.patch
 1487811-3-64a1.patch
@@ -4603,7 +4610,6 @@ NOBUG-20180824-buildsetting-63a1.patch
 1492915-60.patch
 1478843-60.patch
 1500484-64a1.patch
-1479853-60.patch
 1475566-60.patch
 1491848-60.patch
 979649-1-64a1.patch