- /* IF the program already existed, just check if the PMT PID changed */
- if (program->pmt_pid != patp->network_or_program_map_PID) {
+ GST_LOG ("Program exists on pid 0x%04x", program->pmt_pid);
+ /* If the new PMT PID clashes with an existing known PES stream, we know
+ * it is not an update */
+ if (MPEGTS_BIT_IS_SET (base->is_pes, patp->network_or_program_map_PID)) {
+ GST_LOG ("Program is not an update");
+ program =
+ mpegts_base_add_program (base, patp->program_number,
+ patp->network_or_program_map_PID);
+ } else if (program->pmt_pid != patp->network_or_program_map_PID) {
+ /* IF the program already existed, just check if the PMT PID changed */
+ GST_LOG ("PMT is on a different PID");