diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /dom/media/mediasink/OutputStreamManager.h | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.gz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.lz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.tar.xz UXP-9ccb235f04529c1ec345d87dad6521cb567d20bb.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'dom/media/mediasink/OutputStreamManager.h')
-rw-r--r-- | dom/media/mediasink/OutputStreamManager.h | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/dom/media/mediasink/OutputStreamManager.h b/dom/media/mediasink/OutputStreamManager.h index 7f91a60c1..941a86cf0 100644 --- a/dom/media/mediasink/OutputStreamManager.h +++ b/dom/media/mediasink/OutputStreamManager.h @@ -9,6 +9,7 @@ #include "mozilla/RefPtr.h" #include "nsTArray.h" +#include "MediaSegment.h" namespace mozilla { @@ -21,11 +22,13 @@ class ProcessedMediaStream; class OutputStreamData { public: ~OutputStreamData(); - void Init(OutputStreamManager* aOwner, ProcessedMediaStream* aStream); + void Init(OutputStreamManager* aOwner, + ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID); - // Connect mStream to the input stream. + // Connect the given input stream's audio and video tracks to mStream. // Return false is mStream is already destroyed, otherwise true. - bool Connect(MediaStream* aStream); + bool Connect(MediaStream* aStream, TrackID aAudioTrackID, TrackID aVideoTrackID); // Disconnect mStream from its input stream. // Return false is mStream is already destroyed, otherwise true. bool Disconnect(); @@ -34,12 +37,16 @@ public: bool Equals(MediaStream* aStream) const; // Return the graph mStream belongs to. MediaStreamGraph* Graph() const; + // The next TrackID that will not cause a collision in mStream. + TrackID NextAvailableTrackID() const; private: OutputStreamManager* mOwner; RefPtr<ProcessedMediaStream> mStream; - // mPort connects our mStream to an input stream. - RefPtr<MediaInputPort> mPort; + // mPort connects an input stream to our mStream. + nsTArray<RefPtr<MediaInputPort>> mPorts; + // For guaranteeing TrackID uniqueness in our mStream. + TrackID mNextAvailableTrackID = TRACK_INVALID; }; class OutputStreamManager { @@ -47,18 +54,26 @@ class OutputStreamManager { public: // Add the output stream to the collection. - void Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded); + void Add(ProcessedMediaStream* aStream, + TrackID aNextAvailableTrackID, + bool aFinishWhenEnded); // Remove the output stream from the collection. void Remove(MediaStream* aStream); + // Clear all output streams from the collection. + void Clear(); + // The next TrackID that will not cause a collision in aOutputStream. + TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; // Return true if the collection empty. bool IsEmpty() const { MOZ_ASSERT(NS_IsMainThread()); return mStreams.IsEmpty(); } - // Connect all output streams in the collection to the input stream. - void Connect(MediaStream* aStream); - // Disconnect all output streams from the input stream. + // Connect the given input stream's tracks to all output streams. + void Connect(MediaStream* aStream, + TrackID aAudioTrackID, + TrackID aVideoTrackID); + // Disconnect the input stream to all output streams. void Disconnect(); // Return the graph these streams belong to or null if empty. MediaStreamGraph* Graph() const @@ -72,6 +87,8 @@ private: // Keep the input stream so we can connect the output streams that // are added after Connect(). RefPtr<MediaStream> mInputStream; + TrackID mInputAudioTrackID = TRACK_INVALID; + TrackID mInputVideoTrackID = TRACK_INVALID; nsTArray<OutputStreamData> mStreams; }; |