From dbff5c47d32098f697c7b146e0643ef09cf2ad81 Mon Sep 17 00:00:00 2001 From: Benjamin Chen Date: Mon, 25 May 2015 17:37:45 +0800 Subject: [PATCH] Bug 1128448 - 1. Close the pref media.encoder.omx.enabled for newer android version. 2. Modify testcase and MR to eusure no timing issue. r=roc --HG-- extra : rebase_source : fafdef6c6bf2f92b4e441b648a56805e2fa12aed --- dom/media/MediaRecorder.cpp | 3 +-- .../test/test_mediarecorder_unsupported_src.html | 16 +++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 1c757bd7ee9b..f0e585bee2d5 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -638,14 +638,13 @@ private: void DoSessionEndTask(nsresult rv) { MOZ_ASSERT(NS_IsMainThread()); + CleanupStreams(); if (NS_FAILED(rv)) { nsCOMPtr runnable = NS_NewRunnableMethodWithArg(mRecorder, &MediaRecorder::NotifyError, rv); NS_DispatchToMainThread(runnable); } - - CleanupStreams(); if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this)))) { MOZ_ASSERT(false, "NS_DispatchToMainThread EncoderErrorNotifierRunnable failed"); } diff --git a/dom/media/test/test_mediarecorder_unsupported_src.html b/dom/media/test/test_mediarecorder_unsupported_src.html index 1e4aef30f572..789bd2da3a40 100644 --- a/dom/media/test/test_mediarecorder_unsupported_src.html +++ b/dom/media/test/test_mediarecorder_unsupported_src.html @@ -26,6 +26,13 @@ function startTest() { mediaRecorder.onerror = function (e) { callbackStep++; + if (callbackStep == 1) { + try { + mediaRecorder.pause(); + } catch(e) { + ok(false, 'Should not get exception in pause call.'); + } + } ok(callbackStep < 3, 'onerror callback fired as expected.'); is(e.name, 'GenericError', 'Error name should be GenericError.'); is(mediaRecorder.mimeType, '', 'mimetype should be empty'); @@ -60,12 +67,6 @@ function startTest() { } catch(e) { ok(false, 'Should not get exception in start call.'); } - - try { - mediaRecorder.pause(); - } catch(e) { - ok(false, 'Should not get exception in pause call.'); - } }, function(err) { ok(false, 'Unexpected error fired with: ' + err); @@ -81,7 +82,8 @@ SimpleTest.waitForExplicitFinish(); SpecialPowers.pushPrefEnv( { "set": [ - ["media.encoder.webm.enabled", false] + ["media.encoder.webm.enabled", false], + ["media.encoder.omx.enabled", false] ] }, startTest);