From c9567a7fa4d2f182d050c5e17855d5eed6548019 Mon Sep 17 00:00:00 2001 From: Petri Hintukainen Date: Sat, 28 Nov 2009 19:34:26 +0200 Subject: Fixed PMT parsing when PMT does not fit in single TS packet and PAT is in the middle of PMT packets. Parsing PAT resets PMT buffer. If PMT does not fit to single TS packet and PAT packet is scheduled in middle of PMT packets, PMT is never parsed and TS demuxer falls to PID auto detection mode. This moves PMT buffer reset to the case where PMT PID changes and all PIDs are reset. [As far as I can see, worst regression can be invalid PMT sections when stream changes, new PMT pid equals to old one and demuxer is not reset(?), but this should be OK as PMT checksums are always checked.] --- src/demuxers/demux_ts.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 101d49ad3..d258d9c54 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -669,13 +669,12 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt, this->last_pmt_crc = 0; this->videoPid = INVALID_PID; this->spu_pid = INVALID_PID; - } - this->pmt_pid[program_count] = pmt_pid; - if (this->pmt[program_count] != NULL) { - free(this->pmt[program_count]); - this->pmt[program_count] = NULL; - this->pmt_write_ptr[program_count] = NULL; + if (this->pmt[program_count] != NULL) { + free(this->pmt[program_count]); + this->pmt[program_count] = NULL; + this->pmt_write_ptr[program_count] = NULL; + } } #ifdef TS_PAT_LOG if (this->program_number[program_count] != INVALID_PROGRAM) -- cgit v1.2.3