mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
basetsmux: preserve user-specified sections across resets
As sections can be provided by the user through send_event when the element state is NULL, their lifetime is expected to match that of the muxer, and they must be preserved when the state changes
This commit is contained in:
parent
fdfd4600c1
commit
76c3d98962
2 changed files with 22 additions and 1 deletions
|
@ -270,11 +270,21 @@ gst_base_ts_mux_set_header_on_caps (GstBaseTsMux * mux)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
steal_si_section (GstMpegtsSectionType * type, TsMuxSection * section,
|
||||||
|
TsMux * mux)
|
||||||
|
{
|
||||||
|
g_hash_table_insert (mux->si_sections, type, section);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc)
|
gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc)
|
||||||
{
|
{
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
GstBaseTsMuxClass *klass = GST_BASE_TS_MUX_GET_CLASS (mux);
|
GstBaseTsMuxClass *klass = GST_BASE_TS_MUX_GET_CLASS (mux);
|
||||||
|
GHashTable *si_sections = NULL;
|
||||||
|
|
||||||
mux->first = TRUE;
|
mux->first = TRUE;
|
||||||
mux->last_flow_ret = GST_FLOW_OK;
|
mux->last_flow_ret = GST_FLOW_OK;
|
||||||
|
@ -290,6 +300,9 @@ gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc)
|
||||||
gst_adapter_clear (mux->out_adapter);
|
gst_adapter_clear (mux->out_adapter);
|
||||||
|
|
||||||
if (mux->tsmux) {
|
if (mux->tsmux) {
|
||||||
|
if (mux->tsmux->si_sections)
|
||||||
|
si_sections = g_hash_table_ref (mux->tsmux->si_sections);
|
||||||
|
|
||||||
tsmux_free (mux->tsmux);
|
tsmux_free (mux->tsmux);
|
||||||
mux->tsmux = NULL;
|
mux->tsmux = NULL;
|
||||||
}
|
}
|
||||||
|
@ -309,8 +322,16 @@ gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc)
|
||||||
g_assert (klass->create_ts_mux);
|
g_assert (klass->create_ts_mux);
|
||||||
|
|
||||||
mux->tsmux = klass->create_ts_mux (mux);
|
mux->tsmux = klass->create_ts_mux (mux);
|
||||||
|
|
||||||
|
/* Preserve user-specified sections across resets */
|
||||||
|
if (si_sections)
|
||||||
|
g_hash_table_foreach_steal (si_sections, (GHRFunc) steal_si_section,
|
||||||
|
mux->tsmux);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (si_sections)
|
||||||
|
g_hash_table_unref (si_sections);
|
||||||
|
|
||||||
if (klass->reset)
|
if (klass->reset)
|
||||||
klass->reset (mux);
|
klass->reset (mux);
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,7 @@ tsmux_free (TsMux * mux)
|
||||||
g_list_free (mux->streams);
|
g_list_free (mux->streams);
|
||||||
|
|
||||||
/* Free SI table sections */
|
/* Free SI table sections */
|
||||||
g_hash_table_destroy (mux->si_sections);
|
g_hash_table_unref (mux->si_sections);
|
||||||
|
|
||||||
g_slice_free (TsMux, mux);
|
g_slice_free (TsMux, mux);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue