Backed out 2 changesets (bug 1594141) for media failures on test_mediarecorder_principals.html. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Fri, 08 Nov 2019 23:32:18 +0200
changeset 501358 f9f1ad5a1dfa732bfbdc099db1cf5f7e1f931773
parent 501357 75a3afcd0b4ffb432805b33bfd7ea82969fb0d20
child 501359 98da6aa7a8a53528d2efc94e77b8024dd1646fd0
push id114168
push userdluca@mozilla.com
push dateSun, 10 Nov 2019 03:08:55 +0000
treeherdermozilla-inbound@33f64c1ef3e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1594141
milestone72.0a1
backs out6d4a958ff1554c7bc1258da680cb7c9327af529b
0516cc76b5b20ede18eafb873a289d7ababa905a
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
Backed out 2 changesets (bug 1594141) for media failures on test_mediarecorder_principals.html. CLOSED TREE Backed out changeset 6d4a958ff155 (bug 1594141) Backed out changeset 0516cc76b5b2 (bug 1594141)
dom/media/encoder/MediaEncoder.cpp
dom/media/encoder/OpusTrackEncoder.cpp
dom/media/encoder/TrackEncoder.h
dom/media/encoder/VP8TrackEncoder.cpp
dom/media/test/crashtests/1594141.html
dom/media/test/crashtests/crashtests.list
--- a/dom/media/encoder/MediaEncoder.cpp
+++ b/dom/media/encoder/MediaEncoder.cpp
@@ -673,25 +673,16 @@ already_AddRefed<MediaEncoder> MediaEnco
 }
 
 nsresult MediaEncoder::GetEncodedData(
     nsTArray<nsTArray<uint8_t>>* aOutputBufs) {
   AUTO_PROFILER_LABEL("MediaEncoder::GetEncodedData", OTHER);
 
   MOZ_ASSERT(mEncoderThread->IsCurrentThreadIn());
   MOZ_ASSERT(mInitialized);
-
-  if (mError) {
-    // Bail if we're in an error state. This error state is likely caused by
-    // the underlying encoder(s) failing, so don't touch them.
-    LOG(LogLevel::Warning, ("GetEncodedData bailing early because we're in an "
-                            "error state (mError == true)"));
-    return NS_ERROR_ABORT;
-  }
-
   MOZ_ASSERT_IF(mAudioEncoder, mAudioEncoder->IsInitialized());
   MOZ_ASSERT_IF(mVideoEncoder, mVideoEncoder->IsInitialized());
 
   nsresult rv;
   LOG(LogLevel::Verbose,
       ("GetEncodedData TimeStamp = %f", GetEncodeTimeStamp()));
 
   if (mMuxer->NeedsMetadata()) {
@@ -716,42 +707,34 @@ nsresult MediaEncoder::GetEncodedData(
   }
 
   // First, feed encoded data from encoders to muxer.
 
   if (mVideoEncoder && !mVideoEncoder->IsEncodingComplete()) {
     nsTArray<RefPtr<EncodedFrame>> videoFrames;
     rv = mVideoEncoder->GetEncodedTrack(videoFrames);
     if (NS_FAILED(rv)) {
+      // Encoding might be canceled.
       LOG(LogLevel::Error, ("Failed to get encoded data from video encoder."));
-      // Encoding might be canceled. However, if our error isn't from
-      // cancellation, it indicates a more severe error, so set error state.
-      if (rv != NS_ERROR_DOM_MEDIA_CANCELED) {
-        SetError();
-      }
       return rv;
     }
     for (const RefPtr<EncodedFrame>& frame : videoFrames) {
       mMuxer->AddEncodedVideoFrame(frame);
     }
     if (mVideoEncoder->IsEncodingComplete()) {
       mMuxer->VideoEndOfStream();
     }
   }
 
   if (mAudioEncoder && !mAudioEncoder->IsEncodingComplete()) {
     nsTArray<RefPtr<EncodedFrame>> audioFrames;
     rv = mAudioEncoder->GetEncodedTrack(audioFrames);
     if (NS_FAILED(rv)) {
+      // Encoding might be canceled.
       LOG(LogLevel::Error, ("Failed to get encoded data from audio encoder."));
-      // Encoding might be canceled. However, if our error isn't from
-      // cancellation, it indicates a more severe error, so set error state.
-      if (rv != NS_ERROR_DOM_MEDIA_CANCELED) {
-        SetError();
-      }
       return rv;
     }
     for (const RefPtr<EncodedFrame>& frame : audioFrames) {
       mMuxer->AddEncodedAudioFrame(frame);
     }
     if (mAudioEncoder->IsEncodingComplete()) {
       mMuxer->AudioEndOfStream();
     }
--- a/dom/media/encoder/OpusTrackEncoder.cpp
+++ b/dom/media/encoder/OpusTrackEncoder.cpp
@@ -229,17 +229,17 @@ already_AddRefed<TrackMetadataBase> Opus
 
 nsresult OpusTrackEncoder::GetEncodedTrack(
     nsTArray<RefPtr<EncodedFrame>>& aData) {
   AUTO_PROFILER_LABEL("OpusTrackEncoder::GetEncodedTrack", OTHER);
 
   MOZ_ASSERT(mInitialized || mCanceled);
 
   if (mCanceled || mEncodingComplete) {
-    return NS_ERROR_DOM_MEDIA_CANCELED;
+    return NS_ERROR_FAILURE;
   }
 
   if (!mInitialized) {
     // calculation below depends on the truth that mInitialized is true.
     return NS_ERROR_FAILURE;
   }
 
   TakeTrackData(mSourceSegment);
--- a/dom/media/encoder/TrackEncoder.h
+++ b/dom/media/encoder/TrackEncoder.h
@@ -75,21 +75,16 @@ class TrackEncoder {
    * Creates and sets up meta data for a specific codec, called on the worker
    * thread.
    */
   virtual already_AddRefed<TrackMetadataBase> GetMetadata() = 0;
 
   /**
    * Encodes raw segments. Result data is returned in aData, and called on the
    * worker thread.
-   *
-   * @returns NS_OK on success. NS_ERROR_DOM_MEDIA_CANCELED if encoding has
-   *          been canceled or completed, signaling that the encoder will not
-   *          emit more data. Other NS_ERROR_* codes will be returned for fatal
-   *          errors.
    */
   virtual nsresult GetEncodedTrack(nsTArray<RefPtr<EncodedFrame>>& aData) = 0;
 
   /**
    * Returns true once this TrackEncoder is initialized.
    */
   bool IsInitialized();
 
--- a/dom/media/encoder/VP8TrackEncoder.cpp
+++ b/dom/media/encoder/VP8TrackEncoder.cpp
@@ -334,21 +334,18 @@ nsresult VP8TrackEncoder::PrepareRawFram
         NS_SUCCEEDED(Reconfigure(imgSize.width, imgSize.height,
                                  intrinsicSize.width, intrinsicSize.height))) {
       VP8LOG(LogLevel::Info, "Reconfigured VP8 encoder.");
     } else {
       // New frame size is larger; re-create the encoder.
       Destroy();
       nsresult rv = Init(imgSize.width, imgSize.height, intrinsicSize.width,
                          intrinsicSize.height);
-      if (NS_FAILED(rv)) {
-        VP8LOG(LogLevel::Error, "Failed to recreate VP8 encoder.");
-        return rv;
-      }
       VP8LOG(LogLevel::Info, "Recreated VP8 encoder.");
+      NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   // Clear image state from last frame
   mVPXImageWrapper->planes[VPX_PLANE_Y] = nullptr;
   mVPXImageWrapper->stride[VPX_PLANE_Y] = 0;
   mVPXImageWrapper->planes[VPX_PLANE_U] = nullptr;
   mVPXImageWrapper->stride[VPX_PLANE_U] = 0;
@@ -446,17 +443,17 @@ VP8TrackEncoder::EncodeOperation VP8Trac
  */
 nsresult VP8TrackEncoder::GetEncodedTrack(
     nsTArray<RefPtr<EncodedFrame>>& aData) {
   AUTO_PROFILER_LABEL("VP8TrackEncoder::GetEncodedTrack", OTHER);
 
   MOZ_ASSERT(mInitialized || mCanceled);
 
   if (mCanceled || mEncodingComplete) {
-    return NS_ERROR_DOM_MEDIA_CANCELED;
+    return NS_ERROR_FAILURE;
   }
 
   if (!mInitialized) {
     return NS_ERROR_FAILURE;
   }
 
   TakeTrackData(mSourceSegment);
 
deleted file mode 100644
--- a/dom/media/test/crashtests/1594141.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html class="reftest-wait">
-<head>
-    <script>
-      function start () {
-        const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
-        const context = canvas.getContext('2d', {});
-        const stream = canvas.captureStream(30);
-        canvas.width = 32767;
-        const recorder = new MediaRecorder(stream, {});
-        recorder.start();
-        context.strokeText('', -1, 100, 128);
-        setTimeout(() => { document.documentElement.removeAttribute("class"); }, 200);
-      }
-
-      document.addEventListener('DOMContentLoaded', start);
-    </script>
-</head>
-<body>
-</body></html>
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -128,9 +128,8 @@ test-pref(media.autoplay.block-webaudio,
 load track-with-zero-dimensions.mp4 # Bug 1542539
 load 1560215.html
 skip-if(Android) load 1547784.html # Skip on Android as clearkey is not supported
 load 1547899.html
 load 1569645.html
 load 1575271.html
 load 1577184.html
 pref(media.autoplay.default,0) load 1587248.html
-load 1594141.html