Bug 1271669 - Change AnyLocalStreamHasPeerIdentity to be per-track. r?mt draft
authorAndreas Pehrson <pehrsons@gmail.com>
Wed, 18 May 2016 12:55:07 +0200
changeset 369104 66235a4b84c1467dab257e1bc024ee899a2f7ec0
parent 369103 2e9c753afbf6386107ddde8c7ffa781a750cee77
child 369105 769616e681a7bed46561d6935a5a7a5da86556bb
push id18740
push userpehrsons@gmail.com
push dateFri, 20 May 2016 08:44:08 +0000
reviewersmt
bugs1271669
milestone49.0a1
Bug 1271669 - Change AnyLocalStreamHasPeerIdentity to be per-track. r?mt MozReview-Commit-ID: LltvHE9ROfT
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -1664,17 +1664,17 @@ PeerConnectionImpl::SetLocalDescription(
   RefPtr<PeerConnectionObserver> pco = do_QueryObjectReferent(mPCObserver);
   if (!pco) {
     return NS_OK;
   }
 
   STAMP_TIMECARD(mTimeCard, "Set Local Description");
 
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
-  bool isolated = mMedia->AnyLocalStreamHasPeerIdentity();
+  bool isolated = mMedia->AnyLocalTrackHasPeerIdentity();
   mPrivacyRequested = mPrivacyRequested || isolated;
 #endif
 
   mLocalRequestedSDP = aSDP;
 
   JsepSdpType sdpType;
   switch (aAction) {
     case IPeerConnection::kActionOffer:
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -1385,35 +1385,32 @@ LocalSourceStreamInfo::TakePipelineFrom(
 
   mPipelines[newTrackId] = pipeline;
 
   return NS_OK;
 }
 
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
 /**
- * Tells you if any local streams is isolated to a specific peer identity.
- * Obviously, we want all the streams to be isolated equally so that they can
+ * Tells you if any local track is isolated to a specific peer identity.
+ * Obviously, we want all the tracks to be isolated equally so that they can
  * all be sent or not.  We check once when we are setting a local description
  * and that determines if we flip the "privacy requested" bit on.  Once the bit
  * is on, all media originating from this peer connection is isolated.
  *
- * @returns true if any stream has a peerIdentity set on it
+ * @returns true if any track has a peerIdentity set on it
  */
 bool
-PeerConnectionMedia::AnyLocalStreamHasPeerIdentity() const
+PeerConnectionMedia::AnyLocalTrackHasPeerIdentity() const
 {
   ASSERT_ON_THREAD(mMainThread);
 
   for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) {
-    DOMMediaStream* stream = mLocalSourceStreams[u]->GetMediaStream();
-    nsTArray<RefPtr<MediaStreamTrack>> tracks;
-    stream->GetTracks(tracks);
-    for (const RefPtr<MediaStreamTrack>& track : tracks) {
-      if (track->GetPeerIdentity() != nullptr) {
+    for (auto pair : mLocalSourceStreams[u]->GetMediaStreamTracks()) {
+      if (pair.second->GetPeerIdentity() != nullptr) {
         return true;
       }
     }
   }
   return false;
 }
 
 void
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
@@ -387,18 +387,18 @@ class PeerConnectionMedia : public sigsl
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
   // In cases where the peer isn't yet identified, we disable the pipeline (not
   // the stream, that would potentially affect others), so that it sends
   // black/silence.  Once the peer is identified, re-enable those streams.
   // aTrack will be set if this update came from a principal change on aTrack.
   void UpdateSinkIdentity_m(dom::MediaStreamTrack* aTrack,
                             nsIPrincipal* aPrincipal,
                             const PeerIdentity* aSinkIdentity);
-  // this determines if any stream is peerIdentity constrained
-  bool AnyLocalStreamHasPeerIdentity() const;
+  // this determines if any track is peerIdentity constrained
+  bool AnyLocalTrackHasPeerIdentity() const;
   // When we finally learn who is on the other end, we need to change the ownership
   // on streams
   void UpdateRemoteStreamPrincipals_m(nsIPrincipal* aPrincipal);
 #endif
 
   bool AnyCodecHasPluginID(uint64_t aPluginID);
 
   const nsCOMPtr<nsIThread>& GetMainThread() const { return mMainThread; }