Bug 1458166 - Clear out tracks while destroying MediaStream. r=bryce, a=RyanVM
authorAndreas Pehrson <pehrsons@mozilla.com>
Mon, 07 May 2018 11:33:07 +0200
changeset 473287 3da1d132f3832a77bcd8bdd6d68e6f151aba5764
parent 473286 768ac7426e6cd6d500f49dc1e15ff9119cb4cf24
child 473288 8ed61558ac0256d0304f45784eb76250418849ba
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce, RyanVM
bugs1458166
milestone61.0
Bug 1458166 - Clear out tracks while destroying MediaStream. r=bryce, a=RyanVM 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
@@ -2049,16 +2049,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()");