[gst-devel] [SOLVED] gstrtpbin race condition

Wes Miller wmiller at sdr.com
Fri Nov 19 16:43:36 CET 2010


The solution proved to be quite picky but simple.

I added a simple, separate, loop and pipeline that hooked an audiotestsrc to
an encoder, payloader and udpsink. I call this the priming pump.

In the main thread, I set the main pipeline to PLAYING, got rc = async wiat.
Then I started  the priming pump and pointed its udpsink at the main
pipelines udpsrc (i.e. myself).  The data from the priming pump flows into
the main pipe and gets it started.

 --> mainthread --> pipeline to PLAYING, rc = async wait --> launch priming
pump --> main pipeline completes async wait

Since I am using the same programs in two computers, call them host and
client, the freshly started main pipeline on the first machine connects
sound in through the gstrtpbin and out through the udpsink onto the net,
into the other program/PC's udpsrc and that data starts the second instance.

Works great except for the gotchas....

First, data leaving the second machine and flowing into the first uses the
same port as the priming pump.  So I added a num-buffers to the audiotestsrc
in the primer.  Unfortunately, the EOS that produced could cause the second
instance to terminate.So instead, I added a timer to the second thread and
had it abruptly terminate the priming pump so it couldn't send an EOS.

Then there is the matter of unhocking the priming pump's SSRC connection
through gstrtpbin with the actual data streams SSRC.  That required a
padprobe on the priming pump to get its SSRC.  Using that info,
on_pad_added() can tell if incoming data is primer data or real data and
change the connection when real data shows up.

Adding another padprobe on the main udpsrc to see what the current incoming
SSRC is can be used to prevent the launch of the priming thread.  If you are
already working with data you don't need to be primed.

So, hope this helps someone else get started.  The solution is not perfect
as I still have sound quality issues which I've asked about in later posting
to this discussion group.  If/when those questions get answers I may be able
to get a good working solution.

Warmly,

Wes

--- encouraging everyone to post your final solutions.  Unanswered and
incomplete questions help no one. ---


-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/gstrtpbin-race-condition-tp3034437p3050542.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list