Bug 1395022 - Fix MediaRecorder firing unnecessary start event when erroring. r=pehrsons
authorBryce Van Dyk <bvandyk@mozilla.com>
Mon, 04 Sep 2017 08:28:01 +1200
changeset 428555 35a2a0327e51a5952f0a06ebb2cd1ec194269a41
parent 428554 ffb160236c24436a2270922df53f3a3fadcb86a3
child 428556 dfc055f4d93e2875e587927622769aa7e6ccdac5
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspehrsons
bugs1395022
milestone57.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 1395022 - Fix MediaRecorder firing unnecessary start event when erroring. r=pehrsons MozReview-Commit-ID: 6ULFqlEHaqx
dom/media/MediaRecorder.cpp
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -811,19 +811,20 @@ private:
     // end the session.
     mNeedSessionEndTask = false;
   }
   // application should get blob and onstop event
   void DoSessionEndTask(nsresult rv)
   {
     MOZ_ASSERT(NS_IsMainThread());
     CleanupStreams();
-
-    NS_DispatchToMainThread(
-      new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
+    if (!mIsStartEventFired) {
+      NS_DispatchToMainThread(
+        new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
+    }
 
     if (NS_FAILED(rv)) {
       mRecorder->ForceInactive();
       NS_DispatchToMainThread(
         NewRunnableMethod<nsresult>("dom::MediaRecorder::NotifyError",
                                     mRecorder,
                                     &MediaRecorder::NotifyError,
                                     rv));