mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mpegtsbase: Call ::program_stopped after removing all streams
Subclasses want to access the program while removing the streams and will currently crash because of dereferencing NULL in some cases.
This commit is contained in:
parent
3320f29a88
commit
4ca886c53b
1 changed files with 4 additions and 31 deletions
|
@ -503,32 +503,10 @@ mpegts_base_free_program (MpegTSBaseProgram * program)
|
|||
g_free (program);
|
||||
}
|
||||
|
||||
/* FIXME : This is being called by tsdemux::find_timestamps()
|
||||
* We need to avoid re-entrant code like that */
|
||||
static gboolean
|
||||
mpegts_base_stop_program (MpegTSBase * base, MpegTSBaseProgram * program)
|
||||
{
|
||||
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
|
||||
|
||||
GST_DEBUG_OBJECT (base, "program_number : %d", program->program_number);
|
||||
|
||||
if (klass->program_stopped)
|
||||
klass->program_stopped (base, program);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_base_remove_program (MpegTSBase * base, gint program_number)
|
||||
{
|
||||
MpegTSBaseProgram *program;
|
||||
|
||||
GST_DEBUG_OBJECT (base, "program_number : %d", program_number);
|
||||
program =
|
||||
(MpegTSBaseProgram *) g_hash_table_lookup (base->programs,
|
||||
GINT_TO_POINTER (program_number));
|
||||
if (program)
|
||||
mpegts_base_stop_program (base, program);
|
||||
|
||||
g_hash_table_remove (base->programs, GINT_TO_POINTER (program_number));
|
||||
}
|
||||
|
@ -681,10 +659,6 @@ mpegts_base_deactivate_program (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
program->active = FALSE;
|
||||
|
||||
if (program->pmt_info) {
|
||||
/* Inform subclasses we're deactivating this program */
|
||||
if (klass->program_stopped)
|
||||
klass->program_stopped (base, program);
|
||||
|
||||
streams = gst_structure_id_get_value (program->pmt_info, QUARK_STREAMS);
|
||||
nbstreams = gst_value_list_get_size (streams);
|
||||
|
||||
|
@ -709,6 +683,10 @@ mpegts_base_deactivate_program (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
|
||||
GST_DEBUG ("program stream_list is now %p", program->stream_list);
|
||||
}
|
||||
|
||||
/* Inform subclasses we're deactivating this program */
|
||||
if (klass->program_stopped)
|
||||
klass->program_stopped (base, program);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1296,13 +1274,8 @@ static gboolean
|
|||
remove_each_program (gpointer key, MpegTSBaseProgram * program,
|
||||
MpegTSBase * base)
|
||||
{
|
||||
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
|
||||
|
||||
/* First deactivate it */
|
||||
mpegts_base_deactivate_program (base, program);
|
||||
/* Then remove it */
|
||||
if (klass->program_stopped)
|
||||
klass->program_stopped (base, program);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue