Backed out changeset c78c096d0be9 (bug 1397141)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 13 Sep 2017 09:25:33 +0200
changeset 430003 d347d7618b0f9f3449274ad62d58a8cd4e381c77
parent 430002 f6eabbf84e5ecf6f800cf4e69d5951e2b25d3106
child 430004 9764ffce19aa0b20dd55032e854d65e72a1b92c1
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1397141
milestone57.0a1
backs outc78c096d0be97477324fe5b0e94b61094ec5d5d0
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 changeset c78c096d0be9 (bug 1397141)
dom/media/platforms/wrappers/H264Converter.cpp
dom/media/platforms/wrappers/H264Converter.h
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -28,17 +28,17 @@ H264Converter::H264Converter(PlatformDec
   , mTaskQueue(aParams.mTaskQueue)
   , mDecoder(nullptr)
   , mGMPCrashHelper(aParams.mCrashHelper)
   , mLastError(NS_OK)
   , mType(aParams.mType)
   , mOnWaitingForKeyEvent(aParams.mOnWaitingForKeyEvent)
   , mDecoderOptions(aParams.mOptions)
 {
-  mLastError = CreateDecoder(mOriginalConfig, aParams.mDiagnostics);
+  CreateDecoder(mOriginalConfig, aParams.mDiagnostics);
   if (mDecoder) {
     MOZ_ASSERT(mp4_demuxer::H264::HasSPS(mOriginalConfig.mExtraData));
     // The video metadata contains out of band SPS/PPS (AVC1) store it.
     mOriginalExtraData = mOriginalConfig.mExtraData;
   }
 }
 
 H264Converter::~H264Converter()
@@ -76,17 +76,17 @@ H264Converter::Decode(MediaRawData* aSam
 
   if (!mp4_demuxer::AnnexB::IsAVCC(aSample)) {
     return DecodePromise::CreateAndReject(
       MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                   RESULT_DETAIL("Invalid H264 content")),
       __func__);
   }
 
-  MediaResult rv(NS_OK);
+  nsresult rv;
   if (!mDecoder) {
     // It is not possible to create an AVCC H264 decoder without SPS.
     // As such, creation will fail if the extra_data just extracted doesn't
     // contain a SPS.
     rv = CreateDecoderAndInit(aSample);
     if (rv == NS_ERROR_NOT_INITIALIZED) {
       // We are missing the required SPS to create the decoder.
       // Ignore for the time being, the MediaRawData will be dropped.
@@ -107,17 +107,20 @@ H264Converter::Decode(MediaRawData* aSam
 
   if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) {
     // The decoder is pending initialization.
     RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
     return p;
   }
 
   if (NS_FAILED(rv)) {
-    return DecodePromise::CreateAndReject(rv, __func__);
+    return DecodePromise::CreateAndReject(
+      MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
+                  RESULT_DETAIL("Unable to create H264 decoder")),
+      __func__);
   }
 
   if (mNeedKeyframe && !aSample->mKeyframe) {
     return DecodePromise::CreateAndResolve(DecodedData(), __func__);
   }
 
   if (!*mNeedAVCC &&
       !mp4_demuxer::AnnexB::ConvertSampleToAnnexB(aSample, mNeedKeyframe)) {
@@ -235,41 +238,43 @@ H264Converter::SetSeekThreshold(const me
 {
   if (mDecoder) {
     mDecoder->SetSeekThreshold(aTime);
   } else {
     MediaDataDecoder::SetSeekThreshold(aTime);
   }
 }
 
-MediaResult
+nsresult
 H264Converter::CreateDecoder(const VideoInfo& aConfig,
                              DecoderDoctorDiagnostics* aDiagnostics)
 {
   if (!mp4_demuxer::H264::HasSPS(aConfig.mExtraData)) {
     // nothing found yet, will try again later
     return NS_ERROR_NOT_INITIALIZED;
   }
   UpdateConfigFromExtraData(aConfig.mExtraData);
 
   mp4_demuxer::SPSData spsdata;
   if (mp4_demuxer::H264::DecodeSPSFromExtraData(aConfig.mExtraData, spsdata)) {
     // Do some format check here.
     // WMF H.264 Video Decoder and Apple ATDecoder do not support YUV444 format.
     if (spsdata.profile_idc == 244 /* Hi444PP */ ||
         spsdata.chroma_format_idc == PDMFactory::kYUV444) {
+      mLastError = MediaResult(NS_ERROR_FAILURE,
+                               RESULT_DETAIL("Not support for YUV444 format."));
       if (aDiagnostics) {
         aDiagnostics->SetVideoNotSupported();
       }
-      return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                         RESULT_DETAIL("No support for YUV444 format."));
+      return NS_ERROR_FAILURE;
     }
   } else {
-    return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                       RESULT_DETAIL("Invalid SPS NAL."));
+    mLastError = MediaResult(NS_ERROR_FAILURE,
+                             RESULT_DETAIL("Invalid SPS NAL."));
+    return NS_ERROR_FAILURE;
   }
 
   mDecoder = mPDM->CreateVideoDecoder({
     aConfig,
     mTaskQueue,
     aDiagnostics,
     mImageContainer,
     mKnowsCompositor,
@@ -277,42 +282,43 @@ H264Converter::CreateDecoder(const Video
     mType,
     mOnWaitingForKeyEvent,
     mDecoderOptions,
     &mLastError
   });
 
   if (!mDecoder) {
     MOZ_ASSERT(NS_FAILED(mLastError));
-    return MediaResult(mLastError.Code(),
-                       RESULT_DETAIL("Unable to create H264 decoder, reason = %s.",
-                                     mLastError.Description().get()));
+    mLastError = MediaResult(mLastError.Code(),
+                             RESULT_DETAIL("Unable to create H264 decoder, reason = %s.",
+                                           mLastError.Description().get()));
+    return NS_ERROR_FAILURE;
   }
 
   mNeedKeyframe = true;
 
   return NS_OK;
 }
 
-MediaResult
+nsresult
 H264Converter::CreateDecoderAndInit(MediaRawData* aSample)
 {
   RefPtr<MediaByteBuffer> extra_data =
     mp4_demuxer::H264::ExtractExtraData(aSample);
   bool inbandExtradata = mp4_demuxer::H264::HasSPS(extra_data);
   if (!inbandExtradata &&
       !mp4_demuxer::H264::HasSPS(mCurrentConfig.mExtraData)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
 
   if (inbandExtradata) {
     UpdateConfigFromExtraData(extra_data);
   }
 
-  MediaResult rv =
+  nsresult rv =
     CreateDecoder(mCurrentConfig, /* DecoderDoctorDiagnostics* */ nullptr);
 
   if (NS_SUCCEEDED(rv)) {
     RefPtr<H264Converter> self = this;
     RefPtr<MediaRawData> sample = aSample;
     mDecoder->Init()
       ->Then(
         AbstractThread::GetCurrent()->AsTaskQueue(),
@@ -389,17 +395,17 @@ H264Converter::DecodeFirstSample(MediaRa
            },
            [self, this](const MediaResult& aError) {
              mDecodePromiseRequest.Complete();
              mDecodePromise.Reject(aError, __func__);
            })
     ->Track(mDecodePromiseRequest);
 }
 
-MediaResult
+nsresult
 H264Converter::CheckForSPSChange(MediaRawData* aSample)
 {
   RefPtr<MediaByteBuffer> extra_data =
     mp4_demuxer::H264::ExtractExtraData(aSample);
   if (!mp4_demuxer::H264::HasSPS(extra_data)) {
     MOZ_ASSERT(mCanRecycleDecoder.isSome());
     if (!*mCanRecycleDecoder) {
       // If the decoder can't be recycled, the out of band extradata will never
@@ -501,17 +507,17 @@ void H264Converter::FlushThenShutdownDec
                         mShutdownPromise = nullptr;
 
                         if (!mFlushPromise.IsEmpty()) {
                           // A Flush is pending, abort the current operation.
                           mFlushPromise.Resolve(true, __func__);
                           return;
                         }
 
-                        MediaResult rv = CreateDecoderAndInit(sample);
+                        nsresult rv = CreateDecoderAndInit(sample);
                         if (rv == NS_ERROR_DOM_MEDIA_INITIALIZING_DECODER) {
                           // All good so far, will continue later.
                           return;
                         }
                         MOZ_ASSERT(NS_FAILED(rv));
                         mDecodePromise.Reject(rv, __func__);
                         return;
                       },
--- a/dom/media/platforms/wrappers/H264Converter.h
+++ b/dom/media/platforms/wrappers/H264Converter.h
@@ -60,20 +60,20 @@ public:
     return ConversionRequired::kNeedAVCC;
   }
   MediaResult GetLastError() const { return mLastError; }
 
 private:
   // Will create the required MediaDataDecoder if need AVCC and we have a SPS NAL.
   // Returns NS_ERROR_FAILURE if error is permanent and can't be recovered and
   // will set mError accordingly.
-  MediaResult CreateDecoder(const VideoInfo& aConfig,
+  nsresult CreateDecoder(const VideoInfo& aConfig,
                          DecoderDoctorDiagnostics* aDiagnostics);
-  MediaResult CreateDecoderAndInit(MediaRawData* aSample);
-  MediaResult CheckForSPSChange(MediaRawData* aSample);
+  nsresult CreateDecoderAndInit(MediaRawData* aSample);
+  nsresult CheckForSPSChange(MediaRawData* aSample);
   void UpdateConfigFromExtraData(MediaByteBuffer* aExtraData);
 
   bool CanRecycleDecoder() const;
 
   void DecodeFirstSample(MediaRawData* aSample);
   void DrainThenFlushDecoder(MediaRawData* aPendingSample);
   void FlushThenShutdownDecoder(MediaRawData* aPendingSample);
   RefPtr<ShutdownPromise> ShutdownDecoder();