[FFmpeg-cvslog] avcodec/wrapped_avframe: Don't presume AVPacket to be writable

Andreas Rheinhardt git at videolan.org
Mon Jul 18 22:40:21 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Jul 18 19:26:58 2022 +0200| [d72a671c601ae1c7969ab17e2f931b6807add3b9] | committer: Andreas Rheinhardt

avcodec/wrapped_avframe: Don't presume AVPacket to be writable

It need not be writable; in fact, it is often not writable even if
the packet sent to the decoder was writable, because the generic code
calls av_packet_ref() on it. It is never writable if a user
drains the decoder after every packet, because in this case the decode
callback is called from avcodec_send_packet().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d72a671c601ae1c7969ab17e2f931b6807add3b9
---

 libavcodec/wrapped_avframe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wrapped_avframe.c b/libavcodec/wrapped_avframe.c
index 3d2137ccbf..def29a9060 100644
--- a/libavcodec/wrapped_avframe.c
+++ b/libavcodec/wrapped_avframe.c
@@ -92,7 +92,9 @@ static int wrapped_avframe_decode(AVCodecContext *avctx, AVFrame *out,
 
     in  = (AVFrame*)pkt->data;
 
-    av_frame_move_ref(out, in);
+    err = av_frame_ref(out, in);
+    if (err < 0)
+        return err;
 
     err = ff_decode_frame_props(avctx, out);
     if (err < 0)



More information about the ffmpeg-cvslog mailing list