Bug 1364325: replace AddLocalRTPExtensions with SetLocalRTPExtensions. r?bwc draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Thu, 11 May 2017 23:08:37 -0700
changeset 577016 d34a0ad83d9062081de0525fb83bd0f0418829be
parent 576982 1e2fe13035e13b7b4001ade3b48f226957cef5fc
child 628392 da05e44799807ce58e837bbf9f0ceb59a8c02ee5
push id58570
push userdrno@ohlmeier.org
push dateFri, 12 May 2017 17:07:38 +0000
reviewersbwc
bugs1364325
milestone55.0a1
Bug 1364325: replace AddLocalRTPExtensions with SetLocalRTPExtensions. r?bwc MozReview-Commit-ID: G98AVhWA5FU
media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
media/webrtc/signaling/src/media-conduit/VideoConduit.h
media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
--- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
+++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h
@@ -346,17 +346,17 @@ public:
   virtual ~VideoSessionConduit() {}
 
   virtual Type type() const { return VIDEO; }
 
   /**
   * Adds negotiated RTP extensions
   * XXX Move to MediaSessionConduit
   */
-  virtual void AddLocalRTPExtensions(bool aIsSend,
+  virtual void SetLocalRTPExtensions(bool aIsSend,
                                      const std::vector<webrtc::RtpExtension>& extensions) = 0;
 
   /**
   * Returns the negotiated RTP extensions
   */
   virtual std::vector<webrtc::RtpExtension> GetLocalRTPExtensions(bool aIsSend) const = 0;
 
 
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp
@@ -244,29 +244,22 @@ WebrtcVideoConduit::~WebrtcVideoConduit(
   }
 
   // Release AudioConduit first by dropping reference on MainThread, where it expects to be
   SyncTo(nullptr);
   Destroy();
 }
 
 void
-WebrtcVideoConduit::AddLocalRTPExtensions(bool aIsSend,
+WebrtcVideoConduit::SetLocalRTPExtensions(bool aIsSend,
   const std::vector<webrtc::RtpExtension> & aExtensions)
 {
   auto& extList = aIsSend ? mSendStreamConfig.rtp.extensions :
                   mRecvStreamConfig.rtp.extensions;
-  extList.erase(std::remove_if(extList.begin(),
-                               extList.end(),
-                               [&](const webrtc::RtpExtension & i) {
-                                 return std::find(aExtensions.begin(),
-                                                  aExtensions.end(),
-                                                  i) != aExtensions.end(); }),
-                extList.end());
-  extList.insert(extList.end(), aExtensions.begin(), aExtensions.end());
+  extList = aExtensions;
 }
 
 std::vector<webrtc::RtpExtension>
 WebrtcVideoConduit::GetLocalRTPExtensions(bool aIsSend) const
 {
   return aIsSend ? mSendStreamConfig.rtp.extensions : mRecvStreamConfig.rtp.extensions;
 }
 
--- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h
+++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h
@@ -71,22 +71,20 @@ public:
   /* Default maximum bitrate for video streams. */
   static const uint32_t kDefaultMaxBitrate_bps;
 
   //VoiceEngine defined constant for Payload Name Size.
   static const unsigned int CODEC_PLNAME_SIZE;
 
   /**
   * Add rtp extensions to the the VideoSendStream
-  * Note: upon a name collision the old extension is removed and the new one
-  *   takes its place.
   * TODO(@@NG) promote this the MediaConduitInterface when the VoE rework
   * hits Webrtc.org.
   */
-  void AddLocalRTPExtensions(bool aIsSend,
+  void SetLocalRTPExtensions(bool aIsSend,
                              const std::vector<webrtc::RtpExtension>& extensions) override;
   std::vector<webrtc::RtpExtension> GetLocalRTPExtensions(bool aIsSend) const override;
 
   /**
    * Set up A/V sync between this (incoming) VideoConduit and an audio conduit.
    */
   void SyncTo(WebrtcAudioConduit *aConduit);
 
--- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
+++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp
@@ -840,17 +840,17 @@ MediaPipelineFactory::GetOrCreateVideoCo
     // NOTE(pkerr) - this is new behavior. Needed because the CreateVideoReceiveStream
     // method of the Call API will assert (in debug) and fail if a value is not provided
     // for the remote_ssrc that will be used by the far-end sender.
     if (!ssrcs->empty()) {
       conduit->SetRemoteSSRC(ssrcs->front());
     }
 
     if (!extmaps.empty()) {
-      conduit->AddLocalRTPExtensions(false, extmaps);
+      conduit->SetLocalRTPExtensions(false, extmaps);
     }
     auto error = conduit->ConfigureRecvMediaCodecs(configs.values);
     if (error) {
       MOZ_MTLOG(ML_ERROR, "ConfigureRecvMediaCodecs failed: " << error);
       return NS_ERROR_FAILURE;
     }
   } else { //Create a send side
     // For now we only expect to have one ssrc per local track.
@@ -868,17 +868,17 @@ MediaPipelineFactory::GetOrCreateVideoCo
     conduit->SetLocalCNAME(aTrack.GetCNAME().c_str());
 
     rv = ConfigureVideoCodecMode(aTrack, *conduit);
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     if (!extmaps.empty()) {
-      conduit->AddLocalRTPExtensions(true, extmaps);
+      conduit->SetLocalRTPExtensions(true, extmaps);
     }
     auto error = conduit->ConfigureSendMediaCodec(configs.values[0]);
     if (error) {
       MOZ_MTLOG(ML_ERROR, "ConfigureSendMediaCodec failed: " << error);
       return NS_ERROR_FAILURE;
     }
   }