]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegts: make sure mpegts_read_header always stops at the first pmt
authorMarton Balint <cus@passwd.hu>
Sat, 14 Nov 2020 23:31:11 +0000 (00:31 +0100)
committerMarton Balint <cus@passwd.hu>
Thu, 19 Nov 2020 20:22:07 +0000 (21:22 +0100)
mpegts_read_header stops parsing the file at the first PMT. However the check
that ensured this was wrong because streams can also be added before the first
PMT is received (e.g. EIT).

So let's make sure we are in the header reading phase by checking if ts->pkt is
unset instead of checking if the number of streams found so far is 0.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mpegts.c

index 80d010db6cfebb971a092545de446fb6ef99ac9b..a2003c6632347b23530cd9709a4011ac21c2584b 100644 (file)
@@ -2355,7 +2355,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         goto out;
 
     // stop parsing after pmt, we found header
-    if (!ts->stream->nb_streams)
+    if (!ts->pkt)
         ts->stop_parse = 2;
 
     set_pmt_found(ts, h->id);