diff mbox series

[FFmpeg-devel] avcodec/librav1e: Don't unnecessarily create new references

Message ID GV1SPRMB00520BE04C7DAB45E251E1EF8F202@GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 3fd047ee30574fd2dfd739cbb150f87c7225b81f
Headers show
Series [FFmpeg-devel] avcodec/librav1e: Don't unnecessarily create new references | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt March 7, 2024, 4:28 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Absolutely untested (not even compiled).

 libavcodec/librav1e.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Andreas Rheinhardt March 9, 2024, 7:37 p.m. UTC | #1
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> Absolutely untested (not even compiled).
> 
>  libavcodec/librav1e.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
> index dbd728a408..2a6d8bfbed 100644
> --- a/libavcodec/librav1e.c
> +++ b/libavcodec/librav1e.c
> @@ -472,12 +472,8 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
>  
>              if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
>                  fd->frame_opaque = frame->opaque;
> -                ret = av_buffer_replace(&fd->frame_opaque_ref, frame->opaque_ref);
> -                if (ret < 0) {
> -                    frame_data_free(fd);
> -                    av_frame_unref(frame);
> -                    return ret;
> -                }
> +                fd->frame_opaque_ref = frame->opaque_ref;
> +                frame->opaque_ref    = NULL;
>              }
>  
>              rframe = rav1e_frame_new(ctx->ctx);

Will apply tomorrow unless there are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index dbd728a408..2a6d8bfbed 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -472,12 +472,8 @@  static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
 
             if (avctx->flags & AV_CODEC_FLAG_COPY_OPAQUE) {
                 fd->frame_opaque = frame->opaque;
-                ret = av_buffer_replace(&fd->frame_opaque_ref, frame->opaque_ref);
-                if (ret < 0) {
-                    frame_data_free(fd);
-                    av_frame_unref(frame);
-                    return ret;
-                }
+                fd->frame_opaque_ref = frame->opaque_ref;
+                frame->opaque_ref    = NULL;
             }
 
             rframe = rav1e_frame_new(ctx->ctx);