Bug 1294605 - Notify MediaStreamTrackSource when track is notified of ended on main thread. r=jib
☠☠ backed out by e68e4ed5ab6e ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 29 Aug 2016 16:34:27 +0200
changeset 312046 7a14eea64c2a4b576867ae356106f8681e694d4f
parent 312045 1028b87b029e276584a7ae6ab1d2c72dbcbf2daf
child 312047 cf6badc0622b0f6019e2f0ef93730d19f215aa0f
push id81266
push userpehrsons@gmail.com
push dateWed, 31 Aug 2016 14:53:38 +0000
treeherdermozilla-inbound@7a14eea64c2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1294605
milestone51.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()
 {