Bug 1280445 - Clear out all MediaSegments directly on forced MediaStreamGraph shutdown. r=jesup

MozReview-Commit-ID: 3nDPEAAJABw

--HG--
extra : rebase_source : 9bda288ff3dc7382671e365ada7d88c23fc6c50f
extra : source : 43ecb11eccfb4c2bce62b5dc0e3a6c1ddc19609a
This commit is contained in:
Andreas Pehrson 2016-06-16 12:45:29 +01:00
parent e028368c0f
commit f40d583675
3 changed files with 20 additions and 0 deletions

View File

@ -1694,6 +1694,15 @@ public:
// 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.
if (SourceMediaStream* source = stream->AsSourceStream()) {
// Finishing a SourceStream prevents new data from being appended.
source->Finish();
}
stream->GetStreamTracks().Clear();
}
mGraph->mLifecycleState =
MediaStreamGraphImpl::LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION;

View File

@ -108,4 +108,10 @@ StreamTracks::ForgetUpTo(StreamTime aTime)
}
}
void
StreamTracks::Clear()
{
mTracks.Clear();
}
} // namespace mozilla

View File

@ -302,6 +302,11 @@ public:
* Can't be used to forget beyond GetEnd().
*/
void ForgetUpTo(StreamTime aTime);
/**
* Clears out all Tracks and the data they are holding.
* MediaStreamGraph calls this during forced shutdown.
*/
void Clear();
/**
* Returns the latest time passed to ForgetUpTo.
*/