Bug 1208371 - Add GetPeerIdentity() to MediaStreamTrackSource. r?mt
MozReview-Commit-ID: CsiUYQVb8LO
--- a/dom/media/MediaStreamTrack.h
+++ b/dom/media/MediaStreamTrack.h
@@ -18,16 +18,17 @@ namespace mozilla {
class DOMMediaStream;
class MediaEnginePhotoCallback;
class MediaInputPort;
class MediaStream;
class MediaStreamGraph;
class MediaStreamTrackListener;
class PeerConnectionImpl;
+class PeerIdentity;
class ProcessedMediaStream;
class RemoteSourceStreamInfo;
namespace dom {
class AudioStreamTrack;
class VideoStreamTrack;
@@ -71,16 +72,27 @@ public:
/**
* Get the source's current CORSMode. If not applicable CORS_NONE is returned.
* The sink will be notified of changes to our CORSMode through
* NotifyPrincipalChanged().
*/
virtual CORSMode GetCORSMode() const { return CORS_NONE; }
/**
+ * This is used in WebRTC. A peerIdentity constrained MediaStreamTrack cannot
+ * be sent across the network to anything other than a peer with the provided
+ * identity. If this is set, then GetPrincipal() should return an instance of
+ * nsNullPrincipal.
+ *
+ * A track's PeerIdentity is immutable and will not change during the track's
+ * lifetime.
+ */
+ virtual const PeerIdentity* GetPeerIdentity() const { return nullptr; }
+
+ /**
* Indicates whether the track is remote or not per the MediaCapture and
* Streams spec.
*/
virtual bool IsRemote() const { return mIsRemote; }
/**
* Forwards a photo request to backends that support it. Other backends return
* NS_ERROR_NOT_IMPLEMENTED to indicate that a MediaStreamGraph-based fallback
@@ -235,16 +247,21 @@ public:
*/
nsIPrincipal* GetPrincipal() const { return GetSource().GetPrincipal(); }
/**
* Get this track's CORS mode.
*/
CORSMode GetCORSMode() const { return GetSource().GetCORSMode(); }
+ /**
+ * Get this track's PeerIdentity.
+ */
+ const PeerIdentity* GetPeerIdentity() const { return GetSource().GetPeerIdentity(); }
+
MediaStreamGraph* Graph();
MediaStreamTrackSource& GetSource() const
{
MOZ_RELEASE_ASSERT(mSource, "The track source is only removed on destruction");
return *mSource;
}