From d6ea4d83f289580d0ad1508bf1145d4511daf99f Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 12 Apr 2016 04:16:55 +1000 Subject: [PATCH] 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. --- gst/mpegtsdemux/mpegtsbase.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index 293a32ca2d..481695adcb 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -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;