[FFmpeg-cvslog] mpegts: only reopen pmt_cb filter if its different from the previous.

Michael Niedermayer git at videolan.org
Sun Jul 7 19:13:44 CEST 2013


ffmpeg | branch: release/0.7 | Michael Niedermayer <michaelni at gmx.at> | Fri Jul  5 03:27:07 2013 +0200| [dc61d44842699f95e8387144c6046170d1f90d62] | committer: Carl Eugen Hoyos

mpegts: only reopen pmt_cb filter if its different from the previous.

Fixes Ticket2632

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit b009267910df10c004b5f340a090d45da29089a0)

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

 libavformat/mpegts.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index e5c21cc..bcf9b00 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1179,12 +1179,18 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
         if (sid == 0x0000) {
             /* NIT info */
         } else {
+            MpegTSFilter *fil = ts->pids[pmt_pid];
             program = av_new_program(ts->stream, sid);
             program->program_num = sid;
             program->pmt_pid = pmt_pid;
-            if (ts->pids[pmt_pid])
-                mpegts_close_filter(ts, ts->pids[pmt_pid]);
-            mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1);
+            if (fil)
+                if (   fil->type != MPEGTS_SECTION
+                    || fil->pid != pmt_pid
+                    || fil->u.section_filter.section_cb != pmt_cb)
+                    mpegts_close_filter(ts, ts->pids[pmt_pid]);
+
+            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);



More information about the ffmpeg-cvslog mailing list