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 746949 - concat: Add active-pad property
concat: Add active-pad property
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 1.5.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-28 22:01 UTC by Carlos Rafael Giani
Modified: 2015-06-11 10:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
concat active-pad patch (2.62 KB, patch)
2015-03-28 22:01 UTC, Carlos Rafael Giani
none Details | Review
Updated patch to notify property (5.22 KB, patch)
2015-06-11 09:39 UTC, Carlos Rafael Giani
committed Details | Review

Description Carlos Rafael Giani 2015-03-28 22:01:44 UTC
Created attachment 300526 [details] [review]
concat active-pad patch

Right now, the concat element does not offer a way for applications to check what the current sink pad is. This patch adds a read-only active-pad property that works similar to the one from input-selector.
Comment 1 Tim-Philipp Müller 2015-03-29 13:51:59 UTC
Seems reasonable.

Could you describe your use case for it - how would you make use of it?
Comment 2 Carlos Rafael Giani 2015-03-29 14:22:39 UTC
I have been using it on an embedded system where I need to prioritize streaming threads. The currently inactive streams get a lower thread priority. This way, any intensive pre-buffering of not-yet-active streams won't steal CPU time away from the active stream too often.

The streams are made of several elements, most importantly, a uridecodebin element. Inside its pad-added callback, a check is made if the stream's srcpad that is connected to concat is the active pad (this is where I use the active-pad property). If it is, nothing happens, otherwise, the thread priority is lowered.
Later on, once that stream becomes the active one, its thread priority is raised again. This is done in a probe that is attached to the concat sinkpads. The probe checks for EOS events, and raises the thread priority of the soon-to-be-active stream.

By the way, one possible alternative for the EOS probes would be some kind of "about-to-switch" callback that is emitted right before concat switches to the next pad.
Comment 3 Sebastian Dröge (slomo) 2015-06-10 09:53:37 UTC
Comment on attachment 300526 [details] [review]
concat active-pad patch

This should notify the property with g_object_notify_by_pspec() whenever the active pad is changing. Make sure to not hold any mutexes when calling that function :)
Comment 4 Carlos Rafael Giani 2015-06-11 09:39:26 UTC
Created attachment 305057 [details] [review]
Updated patch to notify property

Updated the patch to notify the property via pspec whenever the active-pad changes.
Comment 5 Sebastian Dröge (slomo) 2015-06-11 10:02:54 UTC
commit 77b63521948152d2862a6f66b2cd1326376c1e1b
Author: Carlos Rafael Giani <dv@pseudoterminal.org>
Date:   Thu Jun 11 11:37:30 2015 +0200

    concat: Add active-pad property
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746949