aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-05 03:27:07 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2013-07-07 18:56:03 +0200
commitc25c89a530957fd63ef9ed7fc597bf19b76279cc (patch)
tree432dec060d3cd4049f4f7602fb87745fcc5c792c /libavformat
parent8514e3e08e234fbae7e994c8310730d1a6be1724 (diff)
downloadffmpeg-c25c89a530957fd63ef9ed7fc597bf19b76279cc.tar.gz
mpegts: only reopen pmt_cb filter if its different from the previous.
Fixes Ticket2632 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit b009267910df10c004b5f340a090d45da29089a0)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 99982486d1..b808c40162 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1571,12 +1571,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);