mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1208371 - Move PeerConnection to use PeerIdentity on MediaStreamTrack. r=mt
MozReview-Commit-ID: ILNizs4dzmx --HG-- extra : rebase_source : f0a6aa81a6b04e2db6c8bc746fe19c2ba92e18b4
This commit is contained in:
parent
f46a162bda
commit
cee42d7c20
@ -22,6 +22,7 @@
|
||||
#include "LayersLogging.h"
|
||||
#include "ImageTypes.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "MediaStreamTrack.h"
|
||||
#include "VideoUtils.h"
|
||||
#ifdef WEBRTC_GONK
|
||||
#include "GrallocImages.h"
|
||||
@ -58,6 +59,7 @@
|
||||
#define DEFAULT_SAMPLE_RATE 32000
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
@ -685,18 +687,23 @@ void MediaPipelineTransmit::AttachToTrack(const std::string& track_id) {
|
||||
void MediaPipelineTransmit::UpdateSinkIdentity_m(nsIPrincipal* principal,
|
||||
const PeerIdentity* sinkIdentity) {
|
||||
ASSERT_ON_THREAD(main_thread_);
|
||||
bool enableStream = principal->Subsumes(domstream_->GetPrincipal());
|
||||
if (!enableStream) {
|
||||
|
||||
MediaStreamTrack* track =
|
||||
domstream_->GetOwnedTrackById(NS_ConvertUTF8toUTF16(trackid().c_str()));
|
||||
MOZ_RELEASE_ASSERT(track);
|
||||
|
||||
bool enableTrack = principal->Subsumes(track->GetPrincipal());
|
||||
if (!enableTrack) {
|
||||
// first try didn't work, but there's a chance that this is still available
|
||||
// if our stream is bound to a peerIdentity, and the peer connection (our
|
||||
// sink) is bound to the same identity, then we can enable the stream
|
||||
PeerIdentity* streamIdentity = domstream_->GetPeerIdentity();
|
||||
if (sinkIdentity && streamIdentity) {
|
||||
enableStream = (*sinkIdentity == *streamIdentity);
|
||||
// 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 = track->GetPeerIdentity();
|
||||
if (sinkIdentity && trackIdentity) {
|
||||
enableTrack = (*sinkIdentity == *trackIdentity);
|
||||
}
|
||||
}
|
||||
|
||||
listener_->SetEnabled(enableStream);
|
||||
listener_->SetEnabled(enableTrack);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1199,10 +1199,13 @@ PeerConnectionMedia::AnyLocalStreamHasPeerIdentity() const
|
||||
ASSERT_ON_THREAD(mMainThread);
|
||||
|
||||
for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) {
|
||||
// check if we should be asking for a private call for this stream
|
||||
DOMMediaStream* stream = mLocalSourceStreams[u]->GetMediaStream();
|
||||
if (stream->GetPeerIdentity()) {
|
||||
return true;
|
||||
nsTArray<RefPtr<MediaStreamTrack>> tracks;
|
||||
stream->GetTracks(tracks);
|
||||
for (const RefPtr<MediaStreamTrack>& track : tracks) {
|
||||
if (track->GetPeerIdentity() != nullptr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user