<br><br><div class="gmail_quote">On Mon, Apr 19, 2010 at 9:03 AM, Attila RS <span dir="ltr">&lt;<a href="mailto:avgrind911@gmail.com">avgrind911@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Apr 19, 2010 at 5:21 AM, Stefan Kost <span dir="ltr">&lt;<a href="mailto:ensonic@hora-obscura.de" target="_blank">ensonic@hora-obscura.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div>Attila RS wrote:<br>
&gt; I&#39;m working on a app that needs to dynamically add/remove outputs<br>
&gt; without affecting already active outputs. Below is a simple example.<br>
&gt;<br>
&gt; 1. Receive an RTP stream with audio/video and playback both.<br>
&gt; 2. Stop audio output associated with the above stream.<br>
&gt; 3. Receive a 2nd RTP stream with audio and playback audio.<br>
&gt; 4. Stop 2nd RTP stream.<br>
&gt; 5. Connect audio output back to the first RTP stream without affecting<br>
&gt; the video.<br>
&gt;<br>
&gt; In order to be able to dynamically add/remove outputs I<br>
&gt; have separated the input (udpsrc/depay/demux), the video output<br>
&gt; (decode/vidsink) and the audio output (decode/audsink) into<br>
&gt; 3 separate pipelines and link them together with ghost pads. This<br>
&gt; seems to work well for doing the above controls, but I have 2 problems.<br>
&gt;<br>
&gt; 1. Synchronization is a mess. It looks like each pipeline is using a<br>
&gt; different clock and as a result audio/video is out of sync.<br>
&gt; 2. Adding a new output pipeline to a running input pipeline result in<br>
&gt; out of sync clocks, so the newly added output thinks it is too far<br>
&gt; ahead/behind and just dumps all data instead of outputting it.<br>
&gt; Disabling sync and the newly added pipeline starts playing fine, but<br>
&gt; of course it is out of sync.<br>
&gt;<br>
&gt; I think the second problem can probably be improved or eliminated by<br>
&gt; forcing a new segment event when linking the output, but still the<br>
&gt; clocks need to be synchronized between the pipelines in order for a/v<br>
&gt; to sync correctly and playback smoothly.<br>
&gt;<br>
&gt; Any thoughts on how to better handle these problems? Maybe forcing the<br>
&gt; output pipelines to use the input pipelines clock? Or perhaps there is<br>
&gt; a way to maintain the control I need without using 3 different pipelines?<br>
<br>
</div></div>You want to have one pipeline, so that you share *one* clock. You can<br>
dynamicly link and unlink elements. Read part-blocking.txt in the source<br>
tree under gstreamer/docs/design. You need to use pad-blocking to ensure<br>
no dataflow is happening on the unlinked pads. If a sink is not<br>
conencted its probably a good idea to pause it (and lock the<br>
paused_state). If you don&#39;t use the audiosink, you need to trigger clock<br>
re-selection (dunno how from the top of my head - maybe you can check<br>
what playbin2 does if you unset the audio flag). When connecting a new<br>
upstream branch to a sink, you need to resend the newsegment event to<br>
the sink so that it &#39;knows&#39; whats playing.<br>
<br></blockquote></div></div><div>I guess what I will do then is instead of creating the 3 pipelines I will create 3 bins (one for the input elements, one for the audio elements and one for the video elements) and put them all in the same pipeline. That way I can still easily control the 3 components individually and they will all share the same clock. Then I&#39;ll just have to send the appropriate events when adding/removing from the pipeline. Thanks.</div>
<div class="im">
<div> </div></div></div></blockquote><div>Making most of these changes was fairly straight forward and I can add remove sources as needed. </div><div><br></div><div>I then re-enabled sync on the a/v sinks and started getting a lot of stuttering and dropping of frames along with &quot;There may be a timestamping problem, or this computer is too slow&quot; from the video sink and complaints from the audio sink as well. Also cpu usage would climb to around 90%. I looked around a bit and saw others complaining about this as well. I recently updated all of my gstreamer components to the latest revisions (0.10.23 -&gt; 0.10.28 for gstreamer and gst-base). I went back to the old versions and didn&#39;t see this problem any more (although playback wasn&#39;t perfectly smooth it was close and there were no more errors). Anyone know which version introduced this problem and what components it is associated with? I even saw the problem with a simple mp3 decode pipeline (udpsrc -&gt; rtpmpadepay -&gt; mad -&gt; alsasink).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I know that all this is a bit complicated. Making this easier on the<br>
framework level would be nice ...<br>
<font color="#888888"><br></font></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font color="#888888">Stefan<br>
</font><div><br>
<br>
&gt;<br>
&gt; Thanks for the help.<br>
&gt;<br>
&gt; Attila<br>
</div>&gt; ------------------------------------------------------------------------<br>
<div><div></div><div>&gt;<br>
&gt; ------------------------------------------------------------------------------<br>
&gt; Download Intel&amp;#174; Parallel Studio Eval<br>
&gt; Try the new software tools for yourself. Speed compiling, find bugs<br>
&gt; proactively, and fine-tune applications for parallel performance.<br>
&gt; See why Intel Parallel Studio got high marks during beta.<br>
&gt; <a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
&gt; ------------------------------------------------------------------------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gstreamer-devel mailing list<br>
&gt; <a href="mailto:gstreamer-devel@lists.sourceforge.net" target="_blank">gstreamer-devel@lists.sourceforge.net</a><br>
&gt; <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
&gt;<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Download Intel&amp;#174; Parallel Studio Eval<br>
Try the new software tools for yourself. Speed compiling, find bugs<br>
proactively, and fine-tune applications for parallel performance.<br>
See why Intel Parallel Studio got high marks during beta.<br>
<a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net" target="_blank">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div></div><br>
</blockquote></div><br>