]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegts: never discard PAT pid
authorMarton Balint <cus@passwd.hu>
Sun, 27 Dec 2020 16:35:36 +0000 (17:35 +0100)
committerMarton Balint <cus@passwd.hu>
Sat, 9 Jan 2021 21:38:12 +0000 (22:38 +0100)
PID 0 was removed from the pid list when then PMT was parsed, it is better
to explictly avoid it from being discarded instead of keeing it in the list of
every program.

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

index efff5130dec4bb61bb228f20bea2110a348d70d0..3712dad1c8f18cb476764893363cf92dd0b46a90 100644 (file)
@@ -380,6 +380,9 @@ static int discard_pid(MpegTSContext *ts, unsigned int pid)
     int used = 0, discarded = 0;
     struct Program *p;
 
+    if (pid == PAT_PID)
+        return 0;
+
     /* If none of the programs have .discard=AVDISCARD_ALL then there's
      * no way we have to discard this packet */
     for (k = 0; k < ts->stream->nb_programs; k++)
@@ -2543,7 +2546,6 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
             if (!ts->pids[pmt_pid])
                 mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1);
             add_pat_entry(ts, sid);
-            add_pid_to_pmt(ts, sid, 0); // add pat pid to program
             add_pid_to_pmt(ts, sid, pmt_pid);
         }
     }