Loading image/decoders/nsAVIFDecoder.cpp +14 −6 Original line number Diff line number Diff line Loading @@ -613,15 +613,14 @@ class Dav1dDecoder final : AVIFDecoderInterface { return 0; } static Dav1dResult GetPicture(Dav1dContext& aContext, const MediaRawData& aBytes, static Dav1dResult GetPicture(Dav1dContext& aContext, MediaRawData& aBytes, Dav1dPicture* aPicture, bool aShouldSendTelemetry) { MOZ_ASSERT(aPicture); Dav1dData dav1dData; Dav1dResult r = dav1d_data_wrap(&dav1dData, aBytes.Data(), aBytes.Size(), Dav1dFreeCallback_s, nullptr); Dav1dFreeCallback_s, &aBytes); MOZ_LOG( sAVIFLog, r == 0 ? LogLevel::Verbose : LogLevel::Error, Loading @@ -631,12 +630,22 @@ class Dav1dDecoder final : AVIFDecoderInterface { return r; } // After a successful dav1d_data_wrap call, dav1d effectively owns a // reference to the buffer that aBytes holds until dav1d calls the passed in // free callback Dav1dFreeCallback_s. We handle this with an AddRef here and // a Release in Dav1dFreeCallback_s. aBytes.AddRef(); r = dav1d_send_data(&aContext, &dav1dData); MOZ_LOG(sAVIFLog, r == 0 ? LogLevel::Debug : LogLevel::Error, ("dav1d_send_data -> %d", r)); if (r != 0) { // On failure dav1d leaves the caller's reference to the data intact; // drop it (this invokes Dav1dFreeCallback_s once dav1d holds no other // references). dav1d_data_unref(&dav1dData); return r; } Loading @@ -660,10 +669,9 @@ class Dav1dDecoder final : AVIFDecoderInterface { return r; } // A dummy callback for dav1d_data_wrap static void Dav1dFreeCallback_s(const uint8_t* aBuf, void* aCookie) { // The buf is managed by the mParser inside Dav1dDecoder itself. Do // nothing here. MOZ_ASSERT(aCookie); static_cast<MediaRawData*>(aCookie)->Release(); } static UniquePtr<AVIFDecodedData> Dav1dPictureToDecodedData( Loading Loading
image/decoders/nsAVIFDecoder.cpp +14 −6 Original line number Diff line number Diff line Loading @@ -613,15 +613,14 @@ class Dav1dDecoder final : AVIFDecoderInterface { return 0; } static Dav1dResult GetPicture(Dav1dContext& aContext, const MediaRawData& aBytes, static Dav1dResult GetPicture(Dav1dContext& aContext, MediaRawData& aBytes, Dav1dPicture* aPicture, bool aShouldSendTelemetry) { MOZ_ASSERT(aPicture); Dav1dData dav1dData; Dav1dResult r = dav1d_data_wrap(&dav1dData, aBytes.Data(), aBytes.Size(), Dav1dFreeCallback_s, nullptr); Dav1dFreeCallback_s, &aBytes); MOZ_LOG( sAVIFLog, r == 0 ? LogLevel::Verbose : LogLevel::Error, Loading @@ -631,12 +630,22 @@ class Dav1dDecoder final : AVIFDecoderInterface { return r; } // After a successful dav1d_data_wrap call, dav1d effectively owns a // reference to the buffer that aBytes holds until dav1d calls the passed in // free callback Dav1dFreeCallback_s. We handle this with an AddRef here and // a Release in Dav1dFreeCallback_s. aBytes.AddRef(); r = dav1d_send_data(&aContext, &dav1dData); MOZ_LOG(sAVIFLog, r == 0 ? LogLevel::Debug : LogLevel::Error, ("dav1d_send_data -> %d", r)); if (r != 0) { // On failure dav1d leaves the caller's reference to the data intact; // drop it (this invokes Dav1dFreeCallback_s once dav1d holds no other // references). dav1d_data_unref(&dav1dData); return r; } Loading @@ -660,10 +669,9 @@ class Dav1dDecoder final : AVIFDecoderInterface { return r; } // A dummy callback for dav1d_data_wrap static void Dav1dFreeCallback_s(const uint8_t* aBuf, void* aCookie) { // The buf is managed by the mParser inside Dav1dDecoder itself. Do // nothing here. MOZ_ASSERT(aCookie); static_cast<MediaRawData*>(aCookie)->Release(); } static UniquePtr<AVIFDecodedData> Dav1dPictureToDecodedData( Loading