diff options
author | trav90 <travawine@openmailbox.org> | 2017-10-22 03:46:51 -0500 |
---|---|---|
committer | trav90 <travawine@openmailbox.org> | 2017-10-22 03:46:51 -0500 |
commit | 3c1cedce2dfc534a6df122f29fea3e14a212b44e (patch) | |
tree | 52014d79c098e51c9bd59284941d74ea3ba41e76 | |
parent | ad50da27a4ac33980780bfab2f99095733be0d2e (diff) | |
download | palemoon-gre-3c1cedce2dfc534a6df122f29fea3e14a212b44e.tar.gz |
Move output stream code from MediaDecoder to DecodedStream
-rw-r--r-- | dom/media/DecodedStream.cpp | 15 | ||||
-rw-r--r-- | dom/media/DecodedStream.h | 3 | ||||
-rw-r--r-- | dom/media/MediaDecoder.cpp | 8 |
3 files changed, 18 insertions, 8 deletions
diff --git a/dom/media/DecodedStream.cpp b/dom/media/DecodedStream.cpp index fbe516392..ffaba69c5 100644 --- a/dom/media/DecodedStream.cpp +++ b/dom/media/DecodedStream.cpp @@ -273,4 +273,19 @@ DecodedStream::Connect(OutputStreamData* aStream) aStream->mStream->ChangeExplicitBlockerCount(-1); } +void +DecodedStream::Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded) +{ + MOZ_ASSERT(NS_IsMainThread()); + GetReentrantMonitor().AssertCurrentThreadIn(); + + OutputStreamData* os = OutputStreams().AppendElement(); + os->Init(this, aStream); + Connect(os); + if (aFinishWhenEnded) { + // Ensure that aStream finishes the moment mDecodedStream does. + aStream->SetAutofinish(true); + } +} + } // namespace mozilla diff --git a/dom/media/DecodedStream.h b/dom/media/DecodedStream.h index 06f328dd4..e3eca305e 100644 --- a/dom/media/DecodedStream.h +++ b/dom/media/DecodedStream.h @@ -100,9 +100,10 @@ public: void RecreateData(int64_t aInitialTime, SourceMediaStream* aStream); nsTArray<OutputStreamData>& OutputStreams(); ReentrantMonitor& GetReentrantMonitor(); - void Connect(OutputStreamData* aStream); + void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded); private: + void Connect(OutputStreamData* aStream); UniquePtr<DecodedStreamData> mData; // Data about MediaStreams that are being fed by the decoder. nsTArray<OutputStreamData> mOutputStreams; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index ad94a4c1e..57b5bfb84 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -367,13 +367,7 @@ void MediaDecoder::AddOutputStream(ProcessedMediaStream* aStream, if (!GetDecodedStream()) { RecreateDecodedStream(mLogicalPosition); } - OutputStreamData* os = OutputStreams().AppendElement(); - os->Init(&mDecodedStream, aStream); - mDecodedStream.Connect(os); - if (aFinishWhenEnded) { - // Ensure that aStream finishes the moment mDecodedStream does. - aStream->SetAutofinish(true); - } + mDecodedStream.Connect(aStream, aFinishWhenEnded); } // This can be called before Load(), in which case our mDecoderStateMachine |