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 729583 - Dynamic additions of sinks to playing pipelines seems failure prone.
Dynamic additions of sinks to playing pipelines seems failure prone.
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: dont know
1.2.4
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-05-05 17:04 UTC by Stirling Westrup
Modified: 2014-05-15 17:08 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Stirling Westrup 2014-05-05 17:04:25 UTC
Sorry that I can't give a more concise or accurate bug report here. The problem is that I can't tell if the issue is just one of implementation because I got confused, or documentation because of some procedure that I should be following but which isn't in the manual, or if this is a genuine pipeline negotiation bug.

I took this to the developer forums first, but its been a week since I first posted about this, and have yet to get any feedback whatsoever.

Simply put, I have a video pipeline running, with some output to a monitor. Now I want to be able to dynamically add and remove additional outputs with their attendant post-processing going to new monitors. The intent is to have a video-wall that can be dynamically re-arranged as its running.

I have tried a number of ways to do this, but every time I join a new output pipeline to a tee I (randomly) get one of a number of outcomes:

1) (rarely) it works exactly as expected, and i have a new output.
2) Everything freezes for 10-20 seconds then the new output starts working.
3) The pipeline dies with a not-negotated error.

To illustrate the problem, I wrote a simple program that has a constant video source, and every few seconds toggles between adding and removing an output pipeline. In this case I have a new failure mode in which the new pipeline shows only a single frame of the output, although the pipe appears to be running.

It also hangs in removing the stuck pipeline which seems odd.

My sample code for sinker.c is here:
http://pastebin.com/uGAmx2wu

It can be compiled by:
gcc $(pkg-config --libs --cflags gstreamer-1.0) -o sinker sinker.c
Comment 1 Wim Taymans 2014-05-15 13:10:06 UTC
On line 266, you need to first add, then sync_with_parent and then link or else you might end up with a linked branch in the wrong state.

On line 326 you need to set sync=TRUE on the fakesink or else it just races ahead and a newly added sink will not be able to catch up and sync anymore.

On line 330 you forget to link the queue, leaving the sink without preroll.

Making these changes makes it work for me. There is a delay on the new sink because the queue in front of it starts up empty and needs to fill to the same level as the other (fake) sink before it can work.
Comment 2 Stirling Westrup 2014-05-15 17:08:32 UTC
Thanks immensely for the critique! Can I recommend that some of these issues be made clearer in the manual? From the information provided there its not clear, to someone that doesn't know the internal model of how things work, to know which order these operations should be done in, or why:

a) Add element to pipeline
b) sync element to pipeline's state
c) link with other pipeline elements.