[FFmpeg-cvslog] avformat/mpegts: Do not add pid if its already there with add_pid_to_pmt()

Michael Niedermayer git at videolan.org
Mon Nov 3 23:32:35 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov  3 22:23:54 2014 +0100| [a6593f7cc6e4aeebcae4a0f74ca105940379419e] | committer: Michael Niedermayer

avformat/mpegts: Do not add pid if its already there with add_pid_to_pmt()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6593f7cc6e4aeebcae4a0f74ca105940379419e
---

 libavformat/mpegts.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c01f954..8e639e0 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -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;
 }
 



More information about the ffmpeg-cvslog mailing list