mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
decodebin3: fix collection refcounting
My collection leak fix 83f30627cd
introduced a crash in this scenario: audiotestsrc ! decodebin3 ! fakesink
The reference handling of collection in decodebin3 wasn't very clear and
my attempt to fix the leak introduced a regression where we went one
reference short in some other scenarios.
Fixing this by:
- Giving a strong reference to DecodebinInput making things clearer
- Fixing get_merged_collection() which was sometimes returning an
existing reference and sometimes a new one.
https://bugzilla.gnome.org/show_bug.cgi?id=769080
This commit is contained in:
parent
5044bf79ae
commit
2c0a4d20d4
1 changed files with 4 additions and 2 deletions
|
@ -819,6 +819,8 @@ free_input (GstDecodebin3 * dbin, DecodebinInput * input)
|
||||||
gst_object_unref (input->parsebin);
|
gst_object_unref (input->parsebin);
|
||||||
gst_object_unref (input->parsebin_sink);
|
gst_object_unref (input->parsebin_sink);
|
||||||
}
|
}
|
||||||
|
if (input->collection)
|
||||||
|
gst_object_unref (input->collection);
|
||||||
g_free (input);
|
g_free (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,7 +1035,7 @@ get_merged_collection (GstDecodebin3 * dbin)
|
||||||
|
|
||||||
if (!needs_merge) {
|
if (!needs_merge) {
|
||||||
GST_DEBUG_OBJECT (dbin, "No need to merge, returning %p", res);
|
GST_DEBUG_OBJECT (dbin, "No need to merge, returning %p", res);
|
||||||
return res;
|
return gst_object_ref (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We really need to create a new collection */
|
/* We really need to create a new collection */
|
||||||
|
@ -1142,7 +1144,7 @@ handle_stream_collection (GstDecodebin3 * dbin,
|
||||||
/* Replace collection in input */
|
/* Replace collection in input */
|
||||||
if (input->collection)
|
if (input->collection)
|
||||||
gst_object_unref (input->collection);
|
gst_object_unref (input->collection);
|
||||||
input->collection = collection;
|
input->collection = gst_object_ref (collection);
|
||||||
GST_DEBUG_OBJECT (dbin, "Setting collection %p on input %p", collection,
|
GST_DEBUG_OBJECT (dbin, "Setting collection %p on input %p", collection,
|
||||||
input);
|
input);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue