Bug 1328038: Refuse to play High 4:4:4 Predictive Profile. r=jamescheng draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 03 Jan 2017 06:58:09 +1100
changeset 456472 88159d431560908b61f04a9af5a42b65c9767d54
parent 456417 b548da4e16f067e5b69349376e37b2db97983cf7
child 460679 84fb7eb8422901f8d8c9baaf38232540e7fec061
push id40508
push userbmo:jyavenard@mozilla.com
push dateThu, 05 Jan 2017 18:33:11 +0000
reviewersjamescheng
bugs1328038
milestone53.0a1
Bug 1328038: Refuse to play High 4:4:4 Predictive Profile. r=jamescheng It is not supported by Windows WMF. MozReview-Commit-ID: 2OyjC0qGwD4
dom/media/platforms/PDMFactory.cpp
dom/media/platforms/wrappers/H264Converter.cpp
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -124,22 +124,25 @@ public:
     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) &&
-              spsdata.chroma_format_idc == PDMFactory::kYUV444) {
-            return CheckResult(SupportChecker::Reason::kVideoFormatNotSupported,
-                               MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
-                                           RESULT_DETAIL("Decoder may not have the capability to handle"
-                                                         " the requested video format"
-                                                         " with YUV444 chroma subsampling.")));
+              (spsdata.profile_idc == 244 /* Hi444PP */ ||
+               spsdata.chroma_format_idc == PDMFactory::kYUV444)) {
+            return CheckResult(
+              SupportChecker::Reason::kVideoFormatNotSupported,
+              MediaResult(
+                NS_ERROR_DOM_MEDIA_FATAL_ERR,
+                RESULT_DETAIL("Decoder may not have the capability to handle"
+                              " the requested video format"
+                              " with YUV444 chroma subsampling.")));
           }
         }
         return CheckResult(SupportChecker::Reason::kSupported);
       });
     }
   }
 
   SupportChecker::CheckResult
--- a/dom/media/platforms/wrappers/H264Converter.cpp
+++ b/dom/media/platforms/wrappers/H264Converter.cpp
@@ -176,17 +176,18 @@ H264Converter::CreateDecoder(DecoderDoct
     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*/) {
+    if (spsdata.profile_idc == 244 /* Hi444PP */ ||
+        spsdata.chroma_format_idc == PDMFactory::kYUV444) {
       mLastError = NS_ERROR_FAILURE;
       if (aDiagnostics) {
         aDiagnostics->SetVideoNotSupported();
       }
       return NS_ERROR_FAILURE;
     }
   } else {
     // SPS was invalid.