Bug 1445683 - Updates to AOMDecoder; r=jya draft
authorDan Minor <dminor@mozilla.com>
Mon, 23 Apr 2018 16:03:27 -0400
changeset 811440 bff5f718c89dcd428d8849918fa334ea3a23e70a
parent 811439 2caa9be65fe1e3a4baa34c617361e9422d5dada0
child 811441 49bb83c59eeb8566a6963510270fe19c1a38f4b7
push id114311
push userbmo:dminor@mozilla.com
push dateWed, 27 Jun 2018 17:15:27 +0000
reviewersjya
bugs1445683
milestone63.0a1
Bug 1445683 - Updates to AOMDecoder; r=jya MozReview-Commit-ID: GuTvnPkR1Er
dom/media/platforms/agnostic/AOMDecoder.cpp
--- a/dom/media/platforms/agnostic/AOMDecoder.cpp
+++ b/dom/media/platforms/agnostic/AOMDecoder.cpp
@@ -72,16 +72,17 @@ InitContext(AOMDecoder& aAOMDecoder,
     decode_threads = 4;
   }
   decode_threads = std::min(decode_threads, PR_GetNumberOfProcessors());
 
   aom_codec_dec_cfg_t config;
   PodZero(&config);
   config.threads = decode_threads;
   config.w = config.h = 0; // set after decode
+  config.allow_lowbitdepth = true;
 
   aom_codec_flags_t flags = 0;
 
   auto res = aom_codec_dec_init(aCtx, dx, &config, flags);
   if (res != AOM_CODEC_OK) {
     LOGEX_RESULT(
       &aAOMDecoder, res, "Codec initialization failed, res=%d", int(res));
     return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
@@ -149,26 +150,24 @@ highbd_img_downshift(aom_image_t *dst, a
   if (dst->fmt != (src->fmt & ~AOM_IMG_FMT_HIGHBITDEPTH))
     return AOM_CODEC_INVALID_PARAM;
   if (down_shift < 0)
       return AOM_CODEC_INVALID_PARAM;
   switch (dst->fmt) {
     case AOM_IMG_FMT_I420:
     case AOM_IMG_FMT_I422:
     case AOM_IMG_FMT_I444:
-    case AOM_IMG_FMT_I440:
       break;
     default:
       return AOM_CODEC_INVALID_PARAM;
   }
   switch (src->fmt) {
     case AOM_IMG_FMT_I42016:
     case AOM_IMG_FMT_I42216:
     case AOM_IMG_FMT_I44416:
-    case AOM_IMG_FMT_I44016:
       break;
     default:
       // We don't support anything that's not 16 bit
       return AOM_CODEC_UNSUP_BITSTREAM;
   }
   for (plane = 0; plane < 3; plane++) {
     int w = src->d_w;
     int h = src->d_h;
@@ -198,17 +197,17 @@ AOMDecoder::ProcessDecode(MediaRawData* 
 {
   MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
 
 #if defined(DEBUG)
   NS_ASSERTION(IsKeyframe(*aSample) == aSample->mKeyframe,
                "AOM Decode Keyframe error sample->mKeyframe and si.si_kf out of sync");
 #endif
 
-  if (aom_codec_err_t r = aom_codec_decode(&mCodec, aSample->Data(), aSample->Size(), nullptr, 0)) {
+  if (aom_codec_err_t r = aom_codec_decode(&mCodec, aSample->Data(), aSample->Size(), nullptr)) {
     LOG_RESULT(r, "Decode error!");
     return DecodePromise::CreateAndReject(
       MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR,
                   RESULT_DETAIL("AOM error decoding AV1 sample: %s",
                                 aom_codec_err_to_string(r))),
       __func__);
   }