Bug 1458166 - Clear out tracks while destroying MediaStream. r?bryce
MediaStream::Destroy() is part of a controlled shutdown sequence.
If there are still tracks with content beyond Destroy() they will
only get caught by the dtor, which may be on CC shutdown and too late.
MozReview-Commit-ID: GV6XRiTCIRk
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -2065,16 +2065,17 @@ MediaStream::RemoveAllListenersImpl()
}
void
MediaStream::DestroyImpl()
{
for (int32_t i = mConsumers.Length() - 1; i >= 0; --i) {
mConsumers[i]->Disconnect();
}
+ mTracks.Clear();
mGraph = nullptr;
}
void
MediaStream::Destroy()
{
NS_ASSERTION(mNrOfMainThreadUsers == 0,
"Do not mix Destroy() and RegisterUser()/UnregisterUser()");