Bug 1458166 - Clear out tracks while destroying MediaStream. r?bryce draft
authorAndreas Pehrson <pehrsons@mozilla.com>
Mon, 07 May 2018 11:33:07 +0200
changeset 791997 c0e4bc47c85446dc3a69ce39f8621b05d237a218
parent 786343 378a8a64401f765bfd0706ff678a4f5db7c05385
child 791998 fd6123abc369dba1c77eed1489970a879f4bb436
push id108943
push userbmo:apehrson@mozilla.com
push dateMon, 07 May 2018 09:39:26 +0000
reviewersbryce
bugs1458166
milestone61.0a1
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
dom/media/MediaStreamGraph.cpp
--- 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()");