[FFmpeg-devel] [PATCH v2 8/8] avformat/utils: Remove unnecessary initializations

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Aug 20 00:56:24 EEST 2019


Up until now, read_frame_internal always initialized the packet it
received. But since the recent changes to ff_read_packet, this is no
longer needed: If the parsing queue is initially empty upon entering
read_frame_internal, the packet will now either contain content upon
success or be blank upon failure of ff_read_packet. If the parsing
queue is initially not empty, the packet will be overwritten with the
oldest one from the parsing queue.

Similarly, it is unnecessary to initialize ret.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/utils.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d6d615b690..a81d1e6ca2 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1576,11 +1576,9 @@ static int64_t ts_to_samples(AVStream *st, int64_t ts)
 
 static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret = 0, i, got_packet = 0;
+    int ret, i, got_packet = 0;
     AVDictionary *metadata = NULL;
 
-    av_init_packet(pkt);
-
     while (!got_packet && !s->internal->parse_queue) {
         AVStream *st;
 
-- 
2.21.0



More information about the ffmpeg-devel mailing list