[FFmpeg-devel] [PATCH 2/2] lavf/mpegts: fix av_log use the uninitialized stream id

Jun Zhao mypopydev at gmail.com
Fri May 7 16:03:34 EEST 2021


From: Jun Zhao <barryjzhao at tencent.com>

fix av_log use the uninitialized stream id

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 libavformat/mpegts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9092dbce72..722dae8e36 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2207,7 +2207,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, int pid, unsigned int p
                                       int stream_identifier, int pmt_stream_idx, struct Program *p)
 {
     AVFormatContext *s = ts->stream;
-    int i;
+    int i; // the stream id of the match
     AVStream *found = NULL;
 
     if (stream_identifier) { /* match based on "stream identifier descriptor" if present */
@@ -2218,6 +2218,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, int pid, unsigned int p
         }
     } else if (pmt_stream_idx < p->nb_streams) { /* match based on position within the PMT */
         found = s->streams[p->streams[pmt_stream_idx].idx];
+        i = pmt_stream_idx;
     }
 
     if (found) {
-- 
2.17.1



More information about the ffmpeg-devel mailing list