Bug 1337810 - Use sender SSRC for receivers. r=drno, a=ritu
authorRandell Jesup <rjesup@jesup.org>
Tue, 07 Mar 2017 16:24:00 -0500
changeset 578463 0f6dd3564c7681b5d3da97d52733261308377c83
parent 578462 6fbf8768a0307100a9835a9eb80abe195def54b7
child 578464 145905da25d32c8fd2b1866780a8f0f4f99f5ced
push id58939
push userbmo:cku@mozilla.com
push dateTue, 16 May 2017 04:17:59 +0000
reviewersdrno, ritu
bugs1337810
milestone52.1.2
Bug 1337810 - Use sender SSRC for receivers. r=drno, a=ritu
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -818,21 +818,32 @@ MediaPipelineFactory::GetOrCreateVideoCo
   }
 
   if (configs.values.empty()) {
     MOZ_MTLOG(ML_ERROR, "Can't set up a conduit with 0 codecs");
     return NS_ERROR_FAILURE;
   }
 
   if (receiving) {
-    if (!aTrackPair.mSending) {
+    if (aTrackPair.mSending) {
+      auto ssrcs = &aTrackPair.mSending->GetSsrcs();
+      if (!ssrcs->empty()) {
+        if (!conduit->SetLocalSSRC(ssrcs->front())) {
+          MOZ_MTLOG(ML_ERROR, "SetLocalSSRC failed(1)");
+          return NS_ERROR_FAILURE;
+        }
+      } else {
+        MOZ_MTLOG(ML_ERROR, "Sending without an SSRC??");
+        return NS_ERROR_FAILURE;
+      }
+    } else {
       // No send track, but we still need to configure an SSRC for receiver
       // reports.
       if (!conduit->SetLocalSSRC(aTrackPair.mRecvonlySsrc)) {
-        MOZ_MTLOG(ML_ERROR, "SetLocalSSRC failed");
+        MOZ_MTLOG(ML_ERROR, "SetLocalSSRC failed(2)");
         return NS_ERROR_FAILURE;
       }
     }
 
     // Prune out stuff we cannot actually do. We should work to eliminate the
     // need for this.
     bool configuredH264 = false;
     for (size_t i = 0; i < configs.values.size();) {