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 753622 - splitmuxsink: do not destroy the multiqueue & muxer when going to NULL
splitmuxsink: do not destroy the multiqueue & muxer when going to NULL
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.6.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-14 11:55 UTC by George Kiagiadakis
Modified: 2015-10-30 15:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
splitmuxsink: do not destroy the multiqueue & muxer when going to NULL (1.28 KB, patch)
2015-08-14 11:55 UTC, George Kiagiadakis
none Details | Review
splitmuxsink: do not destroy the multiqueue & muxer when going to NULL (1.69 KB, patch)
2015-10-24 22:00 UTC, George Kiagiadakis
committed Details | Review
tests/check/splitmux: test that the release_pad vfunc of splitmuxsink actually releases pads (1.90 KB, patch)
2015-10-24 22:01 UTC, George Kiagiadakis
committed Details | Review

Description George Kiagiadakis 2015-08-14 11:55:52 UTC
Created attachment 309257 [details] [review]
splitmuxsink: do not destroy the multiqueue & muxer when going to NULL

The release_pad() vfunc in splitmuxsink requires the multiqueue and muxer to be there, otherwise it returns. At the same time, when transitioning from READY to NULL, those elements are destroyed, so when an external user of the element tries to release a previously acquired pad *after* the state has changed to NULL (a totally reasonable thing to do), the pad is not really released and some resources are leaked.

The attached patch avoids releasing the elements in READY->NULL and only releases them in NULL->READY in case they were previously created. The elements are not referenced by splitmuxsink code, they are only referenced by GstBin, so they are also removed in dispose() by GstBin.
Comment 1 Jan Schmidt 2015-08-22 10:45:56 UTC
Review of attachment 309257 [details] [review]:

Looks OK, thanks!
Comment 2 Jan Schmidt 2015-08-22 10:45:58 UTC
Review of attachment 309257 [details] [review]:

Looks OK, thanks!
Comment 3 Jan Schmidt 2015-10-02 14:53:11 UTC
Pushed, with one small change for video_ctx->reference_ctx introduced in other patches. Thanks!

commit 5e4caca709c0f971dc942429a8578eb77133145a
Author: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date:   Fri Apr 17 14:25:43 2015 +0200

    splitmuxsink: post messages when fragments are being opened and closed
    
    This can be useful for applications that need to track the created fragments
    (to log them in a recording database, for example)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750108
Comment 4 Jan Schmidt 2015-10-02 15:14:30 UTC
Actually, this one makes this break in the unit test. The multiqueue and muxer are created already in gst_splitmux_sink_request_new_pad(), so destroying them and recreating them in NULL->READY is no good.

The unit test fails with this patch applied
Comment 5 George Kiagiadakis 2015-10-24 22:00:41 UTC
Created attachment 314036 [details] [review]
splitmuxsink: do not destroy the multiqueue & muxer when going to NULL
Comment 6 George Kiagiadakis 2015-10-24 22:01:10 UTC
Created attachment 314037 [details] [review]
tests/check/splitmux: test that the release_pad vfunc of splitmuxsink actually releases pads
Comment 7 George Kiagiadakis 2015-10-24 22:05:23 UTC
Looking at this again, you are right that reset() cannot be done in NULL->READY. In fact it is not acceptable to reset as long as there are request pads alive. My new approach now will call reset() as soon as all request pads are released, or in READY->NULL if no pads were ever requested.

I also extended the unit test to showcase the bug when the patch is not applied.
Comment 8 Jan Schmidt 2015-10-28 11:42:10 UTC
Thanks! :)