Bug 1215089 - P8: Only enable 10/12 bits videos with software compositor. r?mattwoodrow draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 29 Sep 2017 21:39:50 +0200
changeset 675225 6ad1aa5d40aeb1c6ece0351277d7c5784642c7b7
parent 675224 29890fcdf87d6b1323b70ca088ea4dd2318b9154
child 675226 3988cc3d26297556ae3e5e27af7dcea0aee1e1cf
push id83072
push userbmo:jyavenard@mozilla.com
push dateThu, 05 Oct 2017 01:30:32 +0000
reviewersmattwoodrow
bugs1215089
milestone58.0a1
Bug 1215089 - P8: Only enable 10/12 bits videos with software compositor. r?mattwoodrow MozReview-Commit-ID: 2tdeH2kdZ3P
dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -294,16 +294,28 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(
 
   if (!decoded) {
     if (aGotFrame) {
       *aGotFrame = false;
     }
     return NS_OK;
   }
 
+  if ((mCodecContext->pix_fmt == AV_PIX_FMT_YUV420P10LE ||
+       mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P10LE
+#if LIBAVCODEC_VERSION_MAJOR >= 57
+       || mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P12LE
+#endif
+       ) &&
+      (!mImageAllocator || mImageAllocator->GetCompositorBackendType()
+                           != layers::LayersBackend::LAYERS_BASIC)) {
+    return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
+                       RESULT_DETAIL("unsupported format type (hdr)"));
+  }
+
   // If we've decoded a frame then we need to output it
   int64_t pts = mPtsContext.GuessCorrectPts(mFrame->pkt_pts, mFrame->pkt_dts);
   // Retrieve duration from dts.
   // We use the first entry found matching this dts (this is done to
   // handle damaged file with multiple frames with the same dts)
 
   int64_t duration;
   if (!mDurationMap.Find(mFrame->pkt_dts, duration)) {