Bug 1215089 - P8: Only enable 10/12 bits videos with software compositor. r?mattwoodrow
MozReview-Commit-ID: 2tdeH2kdZ3P
--- 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)) {