After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755770 - decodebin: Free unlinked chains at time of switching chains
decodebin: Free unlinked chains at time of switching chains
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal critical
: 1.6.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-29 04:46 UTC by Rajat Verma
Modified: 2015-10-05 12:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to free hidden groups at the time of switching (1.43 KB, patch)
2015-09-29 04:46 UTC, Rajat Verma
committed Details | Review

Description Rajat Verma 2015-09-29 04:46:44 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.
Comment 1 Rajat Verma 2015-09-30 08:59:06 UTC
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.
Comment 2 Sebastian Dröge (slomo) 2015-10-02 14:02:56 UTC
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