Bug 1395022 - Fix MediaRecorder firing unnecessary start event when erroring. r?pehrsons
MozReview-Commit-ID: 6ULFqlEHaqx
--- 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));