GNOME Bugzilla – Bug 746949
concat: Add active-pad property
Last modified: 2015-06-11 10:02:54 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.
Seems reasonable. Could you describe your use case for it - how would you make use of it?
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 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 :)
Created attachment 305057 [details] [review] Updated patch to notify property Updated the patch to notify the property via pspec whenever the active-pad changes.
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