Bug 1157654 - 1. Do not call MediaRecorder.stop immediately after MediaRecorder.start, because we want to receive an onerror callback. 2. Make the NofityError async. r=roc
authorBenjamin Chen <bechen@mozilla.com>
Thu, 30 Apr 2015 17:13:41 +0800
changeset 242259 a8dcccaf00c4ed6158f285b0e46e915d953a61f1
parent 242258 87329d2ed8ce7a805872efb9ea9c4c9f7efd0525
child 242260 94eb248b77b008cb052750c136f8acd7f77e83f4
push id28686
push userryanvm@gmail.com
push dateMon, 04 May 2015 20:06:04 +0000
treeherdermozilla-central@102d0e9aa9e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1157654
milestone40.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 1157654 - 1. Do not call MediaRecorder.stop immediately after MediaRecorder.start, because we want to receive an onerror callback. 2. Make the NofityError async. r=roc
dom/media/MediaRecorder.cpp
dom/media/test/test_mediarecorder_getencodeddata.html
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -619,17 +619,20 @@ private:
       NS_WARNING("Failed to dispatch ExtractRunnable at beginning");
     }
   }
   // application should get blob and onstop event
   void DoSessionEndTask(nsresult rv)
   {
     MOZ_ASSERT(NS_IsMainThread());
     if (NS_FAILED(rv)) {
-      mRecorder->NotifyError(rv);
+      nsCOMPtr<nsIRunnable> runnable =
+        NS_NewRunnableMethodWithArg<nsresult>(mRecorder,
+                                              &MediaRecorder::NotifyError, rv);
+      NS_DispatchToMainThread(runnable);
     }
 
     CleanupStreams();
     if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) {
       MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed");
     }
     if (NS_FAILED(NS_DispatchToMainThread(new PushBlobRunnable(this)))) {
       MOZ_ASSERT(false, "NS_DispatchToMainThread PushBlobRunnable failed");
--- a/dom/media/test/test_mediarecorder_getencodeddata.html
+++ b/dom/media/test/test_mediarecorder_getencodeddata.html
@@ -53,16 +53,15 @@ SpecialPowers.pushPrefEnv({"set": [["med
            'Event name is GenericError');
         onErrorFired = true;
       }
       mediaRecorder.start(0);
       is(mediaRecorder.state, 'recording', 'Media recorder should be recording');
       is(mediaRecorder.stream, stream,
          'Media recorder stream = element stream at the start of recording');
       mediaRecorder.requestData();
-      mediaRecorder.stop();
     }, 100);
   }
 );
 </script>
 </pre>
 </body>
 </html>