mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
playbin2: always unref the combiner sinkpad when removing the srcpad
Create a function to do the pad cleanup of the GstSourceCombine struct and use it to not forget to also cleanup the sink pad and fix a memory leak. https://bugzilla.gnome.org/show_bug.cgi?id=741198
This commit is contained in:
parent
903ba19593
commit
7e801a5f26
1 changed files with 19 additions and 17 deletions
|
@ -2063,6 +2063,22 @@ gst_play_bin_suburidecodebin_seek_to_start (GstSourceGroup * group)
|
|||
gst_iterator_free (it);
|
||||
}
|
||||
|
||||
static void
|
||||
source_combine_remove_pads (GstPlayBin * playbin, GstSourceCombine * combine)
|
||||
{
|
||||
if (combine->sinkpad) {
|
||||
GST_LOG_OBJECT (playbin, "unlinking from sink");
|
||||
gst_pad_unlink (combine->srcpad, combine->sinkpad);
|
||||
|
||||
/* release back */
|
||||
GST_LOG_OBJECT (playbin, "release sink pad");
|
||||
gst_play_sink_release_pad (playbin->playsink, combine->sinkpad);
|
||||
gst_object_unref (combine->sinkpad);
|
||||
combine->sinkpad = NULL;
|
||||
}
|
||||
gst_object_unref (combine->srcpad);
|
||||
combine->srcpad = NULL;
|
||||
}
|
||||
|
||||
static GstPadProbeReturn
|
||||
block_serialized_data_cb (GstPad * pad, GstPadProbeInfo * info,
|
||||
|
@ -3384,8 +3400,7 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
|
|||
if ((combine = g_object_get_data (G_OBJECT (pad), "playbin.combine"))) {
|
||||
g_assert (combine->combiner == NULL);
|
||||
g_assert (combine->srcpad == pad);
|
||||
gst_object_unref (pad);
|
||||
combine->srcpad = NULL;
|
||||
source_combine_remove_pads (playbin, combine);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -3436,8 +3451,7 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
|
|||
if (!combine->channels->len && combine->combiner) {
|
||||
GST_DEBUG_OBJECT (playbin, "all combiner sinkpads removed");
|
||||
GST_DEBUG_OBJECT (playbin, "removing combiner %p", combine->combiner);
|
||||
gst_object_unref (combine->srcpad);
|
||||
combine->srcpad = NULL;
|
||||
source_combine_remove_pads (playbin, combine);
|
||||
gst_element_set_state (combine->combiner, GST_STATE_NULL);
|
||||
gst_bin_remove (GST_BIN_CAST (playbin), combine->combiner);
|
||||
combine->combiner = NULL;
|
||||
|
@ -5335,19 +5349,7 @@ deactivate_group (GstPlayBin * playbin, GstSourceGroup * group)
|
|||
GST_DEBUG_OBJECT (playbin, "unlinking combiner %s", combine->media_list[0]);
|
||||
|
||||
if (combine->srcpad) {
|
||||
if (combine->sinkpad) {
|
||||
GST_LOG_OBJECT (playbin, "unlinking from sink");
|
||||
gst_pad_unlink (combine->srcpad, combine->sinkpad);
|
||||
|
||||
/* release back */
|
||||
GST_LOG_OBJECT (playbin, "release sink pad");
|
||||
gst_play_sink_release_pad (playbin->playsink, combine->sinkpad);
|
||||
gst_object_unref (combine->sinkpad);
|
||||
combine->sinkpad = NULL;
|
||||
}
|
||||
|
||||
gst_object_unref (combine->srcpad);
|
||||
combine->srcpad = NULL;
|
||||
source_combine_remove_pads (playbin, combine);
|
||||
}
|
||||
|
||||
if (combine->combiner) {
|
||||
|
|
Loading…
Reference in a new issue