GNOME Bugzilla – Bug 755770
decodebin: Free unlinked chains at time of switching chains
Last modified: 2015-10-05 12:54:50 UTC
Created attachment 312342 [details] [review] Patch to free hidden groups at the time of switching I am running below pipeline: gst-launch-1.0 playbin uri=https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8 I am using a h/w based video decoder. At the time of switching pads, hlsdemux sends an EOS on older pad and unlinks it. But my h/w based video decoder was not getting any information that it should close the underlying device apart from EOS. Upon investigation, I came to gstdecodebin2.c >>>>>>>> gst_decode_chain_start_free_hidden_groups_thread (chain); gst_decode_group_hide (chain->active_group); chain->old_groups = g_list_prepend (chain->old_groups, chain->active_group); GST_DEBUG_OBJECT (dbin, "Switching to next group %p", chain->next_groups->data); chain->active_group = chain->next_groups->data; chain->next_groups = g_list_delete_link (chain->next_groups, chain->next_groups); *switched = TRUE; chain->drained = FALSE; In this code, it first starts a thread to free up old_group and then update the old_group itself (which should be in reverse order, that first update the old_group and then call a function to free it) Due to this, old_group was freed only at the time of closing of pipeline itself. This also leads to increase in memory footprint, as hlsdemux keeps selecting different bitrates according to network conditions.
With this change, when hlsdemux exposes new pad to switch bitrate, video decoder in older chain is freed and it cleans up freeing h/w device, and new instance of video decoder gets access to h/w device.
commit 267f4c2bad072d79ed150f97dfb8a45804cd4c7b Author: Rajat Verma <rajat.verma@st.com> Date: Tue Sep 29 10:12:28 2015 +0530 decodebin: free hidden groups at time of switching groups hidden groups should be freed at time of switching groups to avoid memory use from balloning up. https://bugzilla.gnome.org/show_bug.cgi?id=755770