diff options
author | trav90 <travawine@openmailbox.org> | 2017-10-25 03:22:41 -0500 |
---|---|---|
committer | trav90 <travawine@openmailbox.org> | 2017-10-25 03:22:41 -0500 |
commit | d1e0736f77503e61a1394b501b129d86f92351f6 (patch) | |
tree | fb258ce50270d8b6c281584cdab5e1b0bd6e3add | |
parent | 91c8e5499c9e083dce7185812ce0b5c282af99e2 (diff) | |
download | palemoon-gre-d1e0736f77503e61a1394b501b129d86f92351f6.tar.gz |
Rework DecodedStream::RecreateData()
-rw-r--r-- | dom/media/DecodedStream.cpp | 9 | ||||
-rw-r--r-- | dom/media/DecodedStream.h | 3 | ||||
-rw-r--r-- | dom/media/MediaDecoder.cpp | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/dom/media/DecodedStream.cpp b/dom/media/DecodedStream.cpp index 892cf4532..1302709fd 100644 --- a/dom/media/DecodedStream.cpp +++ b/dom/media/DecodedStream.cpp @@ -220,13 +220,16 @@ DecodedStream::DestroyData() } void -DecodedStream::RecreateData(int64_t aInitialTime, SourceMediaStream* aStream) +DecodedStream::RecreateData(int64_t aInitialTime, MediaStreamGraph* aGraph) { MOZ_ASSERT(NS_IsMainThread()); GetReentrantMonitor().AssertCurrentThreadIn(); - MOZ_ASSERT(!mData); + MOZ_ASSERT((aGraph && !mData && OutputStreams().IsEmpty()) || // first time + (!aGraph && mData)); // 2nd time and later - mData.reset(new DecodedStreamData(aInitialTime, aStream)); + auto source = aGraph->CreateSourceStream(nullptr); + DestroyData(); + mData.reset(new DecodedStreamData(aInitialTime, source)); // Note that the delay between removing ports in DestroyDecodedStream // and adding new ones won't cause a glitch since all graph operations diff --git a/dom/media/DecodedStream.h b/dom/media/DecodedStream.h index 5a77c6ac7..ed20174e8 100644 --- a/dom/media/DecodedStream.h +++ b/dom/media/DecodedStream.h @@ -21,6 +21,7 @@ class DecodedStream; class DecodedStreamGraphListener; class OutputStreamListener; class ReentrantMonitor; +class MediaStreamGraph; namespace layers { class Image; @@ -91,7 +92,7 @@ public: explicit DecodedStream(ReentrantMonitor& aMonitor); DecodedStreamData* GetData(); void DestroyData(); - void RecreateData(int64_t aInitialTime, SourceMediaStream* aStream); + void RecreateData(int64_t aInitialTime, MediaStreamGraph* aGraph); nsTArray<OutputStreamData>& OutputStreams(); ReentrantMonitor& GetReentrantMonitor(); void Connect(ProcessedMediaStream* aStream, bool aFinishWhenEnded); diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 57b5bfb84..fd7cae624 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -342,9 +342,7 @@ void MediaDecoder::RecreateDecodedStream(int64_t aStartTimeUSecs) ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); DECODER_LOG("RecreateDecodedStream aStartTimeUSecs=%lld!", aStartTimeUSecs); - mDecodedStream.DestroyData(); - mDecodedStream.RecreateData(aStartTimeUSecs, MediaStreamGraph::GetInstance()->CreateSourceStream(nullptr)); - + mDecodedStream.RecreateData(aStartTimeUSecs, MediaStreamGraph::GetInstance()); UpdateStreamBlockingForStateMachinePlaying(); GetDecodedStream()->mHaveBlockedForPlayState = mPlayState != PLAY_STATE_PLAYING; |