Fixes Ticket2632
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b009267910df10c004b5f340a090d45da29089a0)
... | ... |
@@ -1571,12 +1571,18 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len |
1571 | 1571 |
if (sid == 0x0000) { |
1572 | 1572 |
/* NIT info */ |
1573 | 1573 |
} else { |
1574 |
+ MpegTSFilter *fil = ts->pids[pmt_pid]; |
|
1574 | 1575 |
program = av_new_program(ts->stream, sid); |
1575 | 1576 |
program->program_num = sid; |
1576 | 1577 |
program->pmt_pid = pmt_pid; |
1577 |
- if (ts->pids[pmt_pid]) |
|
1578 |
- mpegts_close_filter(ts, ts->pids[pmt_pid]); |
|
1579 |
- mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); |
|
1578 |
+ if (fil) |
|
1579 |
+ if ( fil->type != MPEGTS_SECTION |
|
1580 |
+ || fil->pid != pmt_pid |
|
1581 |
+ || fil->u.section_filter.section_cb != pmt_cb) |
|
1582 |
+ mpegts_close_filter(ts, ts->pids[pmt_pid]); |
|
1583 |
+ |
|
1584 |
+ if (!ts->pids[pmt_pid]) |
|
1585 |
+ mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); |
|
1580 | 1586 |
add_pat_entry(ts, sid); |
1581 | 1587 |
add_pid_to_pmt(ts, sid, 0); //add pat pid to program |
1582 | 1588 |
add_pid_to_pmt(ts, sid, pmt_pid); |