avformat/mpegts: Do not add pid if its already there with add_pid_to_pmt()
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Nov 2014 21:23:54 +0000 (22:23 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 3 Nov 2014 21:25:55 +0000 (22:25 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mpegts.c

index c01f954..8e639e0 100644 (file)
@@ -299,11 +299,17 @@ static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid,
                            unsigned int pid)
 {
     struct Program *p = get_program(ts, programid);
+    int i;
     if (!p)
         return;
 
     if (p->nb_pids >= MAX_PIDS_PER_PROGRAM)
         return;
+
+    for (i = 0; i < MAX_PIDS_PER_PROGRAM; i++)
+        if (p->pids[i] == pid)
+            return;
+
     p->pids[p->nb_pids++] = pid;
 }