From cb11d79c42cdfe738bf81bb7ae20a5bca6ddd719 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Sat, 25 Apr 2015 11:09:45 -0700 Subject: [PATCH] Bug 1157654 - Back out changeset 4803c84d4976 (bug 1153690) for frequent failures in dom/media/test/test_mediarecorder_getencodeddata.html . --- dom/media/MediaRecorder.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 86491499951..1f15374dde3 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -368,12 +368,11 @@ class MediaRecorder::Session: public nsIObserver public: Session(MediaRecorder* aRecorder, int32_t aTimeSlice) - : mRecorder(aRecorder) - , mTimeSlice(aTimeSlice) - , mStopIssued(false) - , mCanRetrieveData(false) - , mIsRegisterProfiler(false) - , mNeedSessionEndTask(true) + : mRecorder(aRecorder), + mTimeSlice(aTimeSlice), + mStopIssued(false), + mCanRetrieveData(false), + mIsRegisterProfiler(false) { MOZ_ASSERT(NS_IsMainThread()); @@ -397,11 +396,6 @@ public: MOZ_ASSERT(NS_IsMainThread()); mStopIssued = true; CleanupStreams(); - if (mNeedSessionEndTask) { - LOG(PR_LOG_DEBUG, ("Session.Stop mNeedSessionEndTask %p", this)); - // End the Session directly if there is no ExtractRunnable. - DoSessionEndTask(NS_OK); - } nsContentUtils::UnregisterShutdownObserver(this); } @@ -584,10 +578,6 @@ private: LOG(PR_LOG_DEBUG, ("Session.InitEncoder %p", this)); MOZ_ASSERT(NS_IsMainThread()); - if (!mRecorder) { - LOG(PR_LOG_DEBUG, ("Session.InitEncoder failure, mRecorder is null %p", this)); - return; - } // Allocate encoder and bind with union stream. // At this stage, the API doesn't allow UA to choose the output mimeType format. @@ -599,7 +589,6 @@ private: } if (!mEncoder) { - LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mEncoder %p", this)); DoSessionEndTask(NS_ERROR_ABORT); return; } @@ -608,7 +597,6 @@ private: // The Session::stop would clean the mTrackUnionStream. If the AfterTracksAdded // comes after stop command, this function would crash. if (!mTrackUnionStream) { - LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mTrackUnionStream %p", this)); DoSessionEndTask(NS_OK); return; } @@ -617,26 +605,19 @@ private: if (!mReadThread) { nsresult rv = NS_NewNamedThread("Media_Encoder", getter_AddRefs(mReadThread)); if (NS_FAILED(rv)) { - LOG(PR_LOG_DEBUG, ("Session.InitEncoder !mReadThread %p", this)); DoSessionEndTask(rv); return; } } - // In case source media stream does not notify track end, receive + // In case source media stream does not notify track end, recieve // shutdown notification and stop Read Thread. nsContentUtils::RegisterShutdownObserver(this); nsCOMPtr event = new ExtractRunnable(this); if (NS_FAILED(mReadThread->Dispatch(event, NS_DISPATCH_NORMAL))) { NS_WARNING("Failed to dispatch ExtractRunnable at beginning"); - LOG(PR_LOG_DEBUG, ("Session.InitEncoder !ReadThread->Dispatch %p", this)); - DoSessionEndTask(NS_ERROR_ABORT); } - // Set mNeedSessionEndTask to false because the - // ExtractRunnable/DestroyRunnable will take the response to - // end the session. - mNeedSessionEndTask = false; } // application should get blob and onstop event void DoSessionEndTask(nsresult rv) @@ -656,7 +637,6 @@ private: if (NS_FAILED(NS_DispatchToMainThread(new DestroyRunnable(this)))) { MOZ_ASSERT(false, "NS_DispatchToMainThread DestroyRunnable failed"); } - mNeedSessionEndTask = false; } void CleanupStreams() { @@ -730,10 +710,6 @@ private: bool mCanRetrieveData; // The register flag for "Media_Encoder" thread to profiler bool mIsRegisterProfiler; - // False if the InitEncoder called successfully, ensure the - // ExtractRunnable/DestroyRunnable will end the session. - // Main thread only. - bool mNeedSessionEndTask; }; NS_IMPL_ISUPPORTS(MediaRecorder::Session, nsIObserver)