Bug 1271669 - Change AnyLocalStreamHasPeerIdentity to be per-track. r?mt
MozReview-Commit-ID: LltvHE9ROfT
--- 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; }