mpegtsbase: Fix when applying new PMT with same program number

When the sub-class is delaying deactivation of the old program,
but it has the same program number as the new program, don't
overwrite the old program in the hash table and then steal
the new program back out of it. Instead, add the new program to
the hash table after handling removal of the old one.
This commit is contained in:
Jan Schmidt 2016-04-12 04:16:55 +10:00
parent 5115eadc46
commit d6ea4d83f2

View file

@ -886,8 +886,6 @@ mpegts_base_apply_pmt (MpegTSBase * base, GstMpegtsSection * section)
old_program = mpegts_base_steal_program (base, program_number);
program = mpegts_base_new_program (base, program_number, section->pid);
program->patcount = old_program->patcount;
g_hash_table_insert (base->programs,
GINT_TO_POINTER (program_number), program);
/* Desactivate the old program */
/* FIXME : THIS IS BREAKING THE STREAM SWITCHING LOGIC !
@ -901,6 +899,9 @@ mpegts_base_apply_pmt (MpegTSBase * base, GstMpegtsSection * section)
g_hash_table_steal (base->programs,
GINT_TO_POINTER ((gint) old_program->program_number));
}
/* Add new program to the programs we track */
g_hash_table_insert (base->programs,
GINT_TO_POINTER (program_number), program);
initial_program = FALSE;
} else
program = old_program;