Commit 3fb8b068 authored by Timothy Nikkel's avatar Timothy Nikkel
Browse files

Bug 1818725. Don't ignore the return value of nsAVIFDecoder::CreateDecoder. r=Zaggy1024

And also make it return a better result when mDecoder already exists, Complete is not what we want to return.

Depends on D172994

Differential Revision: https://phabricator.services.mozilla.com/D172998
parent 3195265a
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1256,12 +1256,12 @@ nsAVIFDecoder::DecodeResult nsAVIFDecoder::CreateDecoder() {
             StaticPrefs::image_avif_use_dav1d() ? "Dav1d" : "AOM",
             IsDecodeSuccess(r) ? "" : "un"));

    if (!IsDecodeSuccess(r)) {
    return r;
  }
  }

  return DecodeResult(NonDecoderResult::Complete);
  return StaticPrefs::image_avif_use_dav1d()
             ? DecodeResult(Dav1dResult(0))
             : DecodeResult(AOMResult(AOM_CODEC_OK));
}

// Records all telemetry available in the AVIF metadata, called only once during
@@ -1508,7 +1508,10 @@ nsAVIFDecoder::DecodeResult nsAVIFDecoder::DoDecodeInternal(
            ("[this=%p] Parser returned no image size, decoding...", this));
  }

  CreateDecoder();
  r = CreateDecoder();
  if (!IsDecodeSuccess(r)) {
    return r;
  }
  MOZ_ASSERT(mDecoder);
  r = mDecoder->Decode(sendDecodeTelemetry, parsedInfo, parsedImage);
  MOZ_LOG(sAVIFLog, LogLevel::Debug,