diff options
author | Seungha Yang <sh.yang@lge.com> | 2016-12-03 22:28:28 +0900 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2016-12-08 16:59:07 +0100 |
commit | f08e4592a47869c0f86a8f99762b961fddad4864 (patch) | |
tree | a9c251c58761d145af36cfa2f372437ad2d80f93 | |
parent | bd6ec225b992340bb7535ec65726c565a0a137a1 (diff) |
decodebin3: Cleanup no more used DecodebinInput
Remove DecodebinInput using gst_element_call_async() API.
https://bugzilla.gnome.org/show_bug.cgi?id=773341
-rw-r--r-- | gst/playback/gstdecodebin3.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gst/playback/gstdecodebin3.c b/gst/playback/gstdecodebin3.c index a1e9b3b28..74d919e39 100644 --- a/gst/playback/gstdecodebin3.c +++ b/gst/playback/gstdecodebin3.c @@ -484,6 +484,7 @@ static gboolean have_factory (GstDecodebin3 * dbin, GstCaps * caps, #endif static void free_input (GstDecodebin3 * dbin, DecodebinInput * input); +static void free_input_async (GstDecodebin3 * dbin, DecodebinInput * input); static DecodebinInput *create_new_input (GstDecodebin3 * dbin, gboolean main); static gboolean set_input_group_id (DecodebinInput * input, guint32 * group_id); @@ -812,6 +813,18 @@ gst_decodebin3_input_pad_unlink (GstPad * pad, GstObject * parent) if (GST_OBJECT_PARENT (GST_OBJECT (input->parsebin)) == GST_OBJECT (dbin)) { gst_bin_remove (GST_BIN (dbin), input->parsebin); gst_element_set_state (input->parsebin, GST_STATE_NULL); + g_signal_handler_disconnect (input->parsebin, input->pad_removed_sigid); + g_signal_handler_disconnect (input->parsebin, input->pad_added_sigid); + gst_object_unref (input->parsebin); + gst_object_unref (input->parsebin_sink); + + input->parsebin = NULL; + input->parsebin_sink = NULL; + + if (!input->is_main) { + dbin->other_inputs = g_list_remove (dbin->other_inputs, input); + free_input_async (dbin, input); + } } INPUT_UNLOCK (dbin); return; @@ -839,6 +852,14 @@ free_input (GstDecodebin3 * dbin, DecodebinInput * input) g_free (input); } +static void +free_input_async (GstDecodebin3 * dbin, DecodebinInput * input) +{ + GST_LOG_OBJECT (dbin, "pushing input %p on thread pool to free", input); + gst_element_call_async (GST_ELEMENT_CAST (dbin), + (GstElementCallAsyncFunc) free_input, input, NULL); +} + /* Call with INPUT_LOCK taken */ static DecodebinInput * create_new_input (GstDecodebin3 * dbin, gboolean main) |