Bug 1300693 - BBCiPlayer (TV) HTML5 broken in Nightly 51.0a1. r=jya
authorJames Cheng <jacheng@mozilla.com>
Tue, 06 Sep 2016 14:16:07 +0800
changeset 313096 a89000231432bf06a069e8269af8e8a3e7f77bed
parent 313095 3756b6695c104555ddbb0c33d28a3ce9425cee3f
child 313097 4d978f6af1cd9f25307e4aa32a4fadd42ec216e3
push id30671
push usercbook@mozilla.com
push dateThu, 08 Sep 2016 09:59:51 +0000
treeherdermozilla-central@bd28be90aed8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1300693
milestone51.0a1
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
Bug 1300693 - BBCiPlayer (TV) HTML5 broken in Nightly 51.0a1. r=jya MozReview-Commit-ID: KY0EpZGZ85A
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/wrappers/H264Converter.cpp
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -104,17 +104,17 @@ public:
     RefPtr<MediaByteBuffer> extraData = aTrackConfig.GetAsVideoInfo()->mExtraData;
     AddToCheckList(
       [mimeType, extraData]() {
         if (MP4Decoder::IsH264(mimeType)) {
           mp4_demuxer::SPSData spsdata;
           // WMF H.264 Video Decoder and Apple ATDecoder
           // do not support YUV444 format.
           // For consistency, all decoders should be checked.
-          if (!mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) ||
+          if (mp4_demuxer::H264::DecodeSPSFromExtraData(extraData, spsdata) &&
               spsdata.chroma_format_idc == PDMFactory::kYUV444) {
             return SupportChecker::Result::kVideoFormatNotSupported;
           }
         }
         return SupportChecker::Result::kSupported;
       });
     }
   }
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -132,16 +132,34 @@ H264Converter::IsHardwareAccelerated(nsA
 nsresult
 H264Converter::CreateDecoder(DecoderDoctorDiagnostics* aDiagnostics)
 {
   if (mNeedAVCC && !mp4_demuxer::AnnexB::HasSPS(mCurrentConfig.mExtraData)) {
     // nothing found yet, will try again later
     return NS_ERROR_NOT_INITIALIZED;
   }
   UpdateConfigFromExtraData(mCurrentConfig.mExtraData);
+
+  mp4_demuxer::SPSData spsdata;
+  if (mp4_demuxer::H264::DecodeSPSFromExtraData(mCurrentConfig.mExtraData, spsdata)) {
+    // Do some format check here.
+    // WMF H.264 Video Decoder and Apple ATDecoder do not support YUV444 format.
+    if (spsdata.chroma_format_idc == 3 /*YUV444*/) {
+      mLastError = NS_ERROR_FAILURE;
+      if (aDiagnostics) {
+        aDiagnostics->SetVideoFormatNotSupport();
+      }
+      return NS_ERROR_FAILURE;
+    }
+  } else if (mNeedAVCC) {
+    // SPS was invalid.
+    mLastError = NS_ERROR_FAILURE;
+    return NS_ERROR_FAILURE;
+  }
+
   if (!mNeedAVCC) {
     // When using a decoder handling AnnexB, we get here only once from the
     // constructor. We do want to get the dimensions extracted from the SPS.
     mOriginalConfig = mCurrentConfig;
   }
 
   mDecoder = mPDM->CreateVideoDecoder({
     mNeedAVCC ? mCurrentConfig : mOriginalConfig,