Bug 1294605 - Notify MediaStreamTrackSource when track is notified of ended on main thread. r=jib
☠☠ backed out by f5feb30dd175 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 29 Aug 2016 16:34:27 +0200
changeset 318758 c0c023815311c2632a9763b696492342b0e829e1
parent 318757 443a94083e005ad58574d3571be3299ffc6d8029
child 318759 75faf4827dcf906c0e6573affa6ce1689fd79ea8
push id33357
push usercbook@mozilla.com
push dateThu, 20 Oct 2016 15:28:23 +0000
treeherderautoland@24f14dccbbd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1294605
milestone52.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
Bug 1294605 - Notify MediaStreamTrackSource when track is notified of ended on main thread. r=jib I haven't seen test failures from this but I imagine there could be. MozReview-Commit-ID: 8iyMBzQCWeA
dom/media/MediaStreamTrack.cpp
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -409,16 +409,23 @@ MediaStreamTrack::NotifyEnded()
   MOZ_ASSERT(NS_IsMainThread());
 
   if (Ended()) {
     return;
   }
 
   LOG(LogLevel::Info, ("MediaStreamTrack %p ended", this));
 
+  if (!mSource) {
+    MOZ_ASSERT(false);
+    return;
+  }
+
+  mSource->UnregisterSink(this);
+
   mReadyState = MediaStreamTrackState::Ended;
 
   DispatchTrustedEvent(NS_LITERAL_STRING("ended"));
 }
 
 DOMMediaStream*
 MediaStreamTrack::GetInputDOMStream()
 {