[FFmpeg-devel] [PATCH v2 3/4] avformat/nutdec: Don't shrink packet size manually

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Sep 20 19:46:44 EEST 2022


It is unnecessary because an av_shrink_packet() a few lines below
will set the size; furthermore, it is actually harmful, because
av_shrink_packet() does nothing in case the size already matches,
so that the packet's padding is not correctly zeroed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
I was about to make append_packet_chunked non-static, but then I noticed
that it unrefs the packet if the end size is zero (this might cause
problems for side-data only packets).

 libavformat/nutdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 8cc56615ad..1d04f51d8d 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1127,7 +1127,6 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
         }
         sm_size = avio_tell(bc) - pkt->pos;
         size      -= sm_size;
-        pkt->size -= sm_size;
     }
 
     ret = avio_read(bc, pkt->data + nut->header_len[header_idx], size);
-- 
2.34.1



More information about the ffmpeg-devel mailing list