Bug 900419 - Media Recording - MediaRecorder's state is wrong when stopping media stream during recording. r=roc
authorRandy Lin <rlin@mozilla.com>
Thu, 01 Aug 2013 18:38:57 +0800
changeset 154802 e40f8b1eb392ccbcfa264f89e18a4499603e6ff6
parent 154801 f30d4621eac8f964f4b8ef58ebd072c779f70770
child 154803 e50cae680d8c5cd619b6977f547acbb8ffafcff7
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs900419
milestone26.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 900419 - Media Recording - MediaRecorder's state is wrong when stopping media stream during recording. r=roc
content/media/MediaRecorder.cpp
--- a/content/media/MediaRecorder.cpp
+++ b/content/media/MediaRecorder.cpp
@@ -84,16 +84,17 @@ public:
   {
   public:
     ReleaseEncoderThreadTask(already_AddRefed<MediaRecorder> recorder)
       : mRecorder(recorder) {}
 
     NS_IMETHODIMP Run()
     {
       MOZ_ASSERT(NS_IsMainThread());
+      mRecorder->mState = RecordingState::Inactive;
       mRecorder->DispatchSimpleEvent(NS_LITERAL_STRING("stop"));
       mRecorder->mReadThread->Shutdown();
       mRecorder->mReadThread = nullptr;
       return NS_OK;
     }
 
   private:
     nsRefPtr<MediaRecorder> mRecorder;
@@ -223,17 +224,16 @@ MediaRecorder::Start(const Optional<int3
 void
 MediaRecorder::Stop(ErrorResult& aResult)
 {
   if (mState == RecordingState::Inactive) {
     aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
   mTrackUnionStream->RemoveListener(mEncoder);
-  mState = RecordingState::Inactive;
 }
 
 void
 MediaRecorder::Pause(ErrorResult& aResult)
 {
   if (mState != RecordingState::Recording) {
     aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;