author | Andreas Pehrson <pehrsons@mozilla.com> |
Fri, 27 Oct 2017 10:12:59 +0200 | |
changeset 440598 | d9257f9b2296e23faf43594a4f3c1698003e6a2b |
parent 440597 | db0fa983b90f44be14aa9b31257149aee28ea6b9 |
child 440599 | 0253bbb60b2fc61bc4e32943dfcacde5f26e680a |
push id | 8118 |
push user | ryanvm@gmail.com |
push date | Fri, 03 Nov 2017 00:38:34 +0000 |
treeherder | mozilla-beta@1c336e874ae8 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | padenot |
bugs | 1410829 |
milestone | 58.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -1584,16 +1584,29 @@ public: MOZ_ASSERT(false, "AudioCallbackDriver took too long to shut down and we let shutdown" " continue - freezing and leaking"); // The timer fired, so we may be deeper in shutdown now. Block any further // teardown and just leak, for safety. return NS_OK; } + + for (MediaStream* stream : mGraph->AllStreams()) { + // Clean up all MediaSegments since we cannot release Images too + // late during shutdown. Also notify listeners that they were removed + // so they can clean up any gfx resources. + if (SourceMediaStream* source = stream->AsSourceStream()) { + // Finishing a SourceStream prevents new data from being appended. + source->Finish(); + } + stream->GetStreamTracks().Clear(); + stream->RemoveAllListenersImpl(); + } + mGraph->mForceShutdownTicket = nullptr; // We can't block past the final LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION // stage, since completion of that stage requires all streams to be freed, // which requires shutdown to proceed. // mGraph's thread is not running so it's OK to do whatever here if (mGraph->IsEmpty()) { @@ -1601,28 +1614,16 @@ public: mGraph->Destroy(); } else { // The graph is not empty. We must be in a forced shutdown, or a // non-realtime graph that has finished processing. Some later // AppendMessage will detect that the graph has been emptied, and // delete it. NS_ASSERTION(mGraph->mForceShutDown || !mGraph->mRealtime, "Not in forced shutdown?"); - for (MediaStream* stream : mGraph->AllStreams()) { - // Clean up all MediaSegments since we cannot release Images too - // late during shutdown. Also notify listeners that they were removed - // so they can clean up any gfx resources. - if (SourceMediaStream* source = stream->AsSourceStream()) { - // Finishing a SourceStream prevents new data from being appended. - source->Finish(); - } - stream->GetStreamTracks().Clear(); - stream->RemoveAllListenersImpl(); - } - mGraph->mLifecycleState = MediaStreamGraphImpl::LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION; } return NS_OK; } private: RefPtr<MediaStreamGraphImpl> mGraph; };