<div dir="ltr">In gstreamer, a queue is also a thread boundary.  

By adding queues you are adding threads.  My theory:  In your scenario, the extra queue (with thread) may be allowing audio information to flow through your pipeline more freely.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 14, 2020 at 7:35 AM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le samedi 12 décembre 2020 à 13:21 -0600, jim nualart a écrit :<br>
> A little more info on this...<br>
> <br>
> 1. By "gaps", I mean silence or 0s. And this is not simply an artifact of<br>
> using filesrc to write a wav. The gaps are also audible (or rather, not<br>
> audible, since it's silence, but I think everyone knows what I mean :-)<br>
> <br>
> 2. As I mentioned previously, I see the same behavior (gaps) if I replace<br>
> audiotestsrc with alsasrc (pointing to a line-in where I am playing a sine<br>
> wave from my phone).<br>
> <br>
> 3. Enabling GST_DEBUG=audioaggregator:5 I see a Timeout msg, e.g., "Timeout,<br>
> missing 36 frames (0:00:00.000816326)" that corresponds to all the gaps in the<br>
> resulting wav file.<br>
> <br>
> Based on that, I start to think that maybe I need to set a latency on the<br>
> audiomixer (the default is 0). However, no value I use makes any difference.<br>
> <br>
> Next, and I can't explain why, I put a queue immediately after the<br>
> audiomixer (no latency or other non-default settings). This eliminates the<br>
> Timeouts (and gaps of silence). This holds true when I switch back to an<br>
> alsasrc instead of the audiotestsrc.<br>
<br>
I have also hit situation were a queue was needed after audiomixer /<br>
audiointerleave in order for the timeout mechanism to work properly. Basically,<br>
push-back from downstream can delay the aggregator passed it's timeout, and you<br>
may endup in that state forever.<br>
<br>
This is a limitation of the timeout mechanism I believe, at least I don't see<br>
other way around to make this timeout behave like intented.<br>
<br>
> <br>
> I dumped the graphs -- the queue (it's the only queue in the very short<br>
> pipeline) does not show as buffering any data. So I am really confused as to<br>
> how this "fixed" the issue.<br>
> <br>
> Does anyone have an explanation? I'd settle for even just a well-written<br>
> theory :-)<br>
> <br>
> thanks in advance,<br>
> -jim<br>
> <br>
> <br>
>  <br>
> > Hi Matt,<br>
> > I tried that as well. I get the same result .. gaps every 5 seconds.<br>
> > <br>
> > If I remove is-live (with or without do-timestamp), then there are no gaps.<br>
> > However, in this case, I also get a much larger, and longer, file; which I<br>
> > don't understand.<br>
> > <br>
> > And again, if I use an adder (vs audiomixer), I get no gaps (with is-live<br>
> > and do-timestamp both true). And if I remove the adder, same ... no gaps.<br>
> > <br>
> > I'm trying not to get hung up on audiotestsrc itself as it is simply a way<br>
> > for me to demonstrate what I see with my pipeline using alsasrc and an<br>
> > audiomixer.<br>
> > <br>
> > I suppose I don't really understand what audiomixer is doing. Another<br>
> > oddity (I think) is that if instead of running the sample pipeline for a<br>
> > set time (using the timeout command), I instead use num-buffers=1000 (in<br>
> > audiotestsrc), I get different resulting file sizes:<br>
> > - with an adder, I get a file with 10.884s of audio and a size of 960056<br>
> > bytes.<br>
> > - with an audiomixer, I get a file with 10.920s of audio and a size<br>
> > of 1926332 bytes.<br>
> > <br>
> > Any chance someone is willing to run the same test and compare results?<br>
> > export TESTSOURCE1="audiotestsrc wave=0 volume=0.8 is-live=true<br>
> > do-timestamp=true samplesperbuffer=480"<br>
> > export SINK="wavenc ! filesink location=test.wav"<br>
> > timeout 60 gst-launch-1.0 $TESTSOURCE1 blocksize=960 ! audiomixer ! $SINK<br>
> > <br>
> > The gaps go away if I use an adder, as does my actual problem in my "real"<br>
> > pipeline, but I'd like to understand why.<br>
> > <br>
> > thanks in advance,<br>
> > -jim<br>
> > <br>
> > <br>
> > > Date: Tue, 8 Dec 2020 19:05:25 +1100<br>
> > > From: Matthew Waters <<a href="mailto:ystreet00@gmail.com" target="_blank">ystreet00@gmail.com</a>><br>
> > > <br>
> > > Don't use 'do-timestamp=true' with audiotestsrc.? It will not do the<br>
> > > right thing.<br>
> > > <br>
> > > Cheers<br>
> > > -Matt<br>
> > > <br>
> > > On 8/12/20 5:12 pm, jim nualart wrote:<br>
> > > > Hi,<br>
> > > > Hoping that someone can shed some light on this...<br>
> > > > <br>
> > > > The following pipeline results in a file with gaps every 5 seconds:<br>
> > > > export TESTSOURCE1="audiotestsrc wave=0 volume=0.8 is-live=true<br>
> > > > do-timestamp=true samplesperbuffer=480"<br>
> > > > export SINK="wavenc ! filesink location=test.wav"<br>
> > > > timeout 60 gst-launch-1.0 $TESTSOURCE1 ! audiomixer ! $SINK<br>
> > > > <br>
> > > > If you open the resulting wav file (e.g., in audacity), there are gaps<br>
> > > > every 5 seconds.<br>
> > > > <br>
> > > > If you remove the audiomixer?from the pipeline, there are no gaps. If<br>
> > > > you use an adder (instead of the audiomixer), there are no gaps.<br>
> > > > <br>
> > > > I've looked at logs (GST_DEBUG=audiomixer:6), and there are no obvious<br>
> > > > errors/warnings/etc.<br>
> > > > <br>
> > > > I realize that the audiotestsrc is not really a live-source and I'm<br>
> > > > not sure how well it behaves as such. But I am actually<br>
> > > > troubleshooting a similar issue using an alsasrc instead. I am hoping<br>
> > > > that if I understand what's going on here, it will help on the other<br>
> > > > issue. (For the issue with the alsasrc, I've gone so far as to write<br>
> > > > the data to files; one at the src of the element feeding the<br>
> > > > audiomixer, and one at the src of the audiomixer itself -- the first<br>
> > > > shows no gaps, while the later does show gaps.)<br>
> > > > <br>
> > > > Many thanks in advance to any advice.<br>
> > > > -jim<br>
> > > > <br>
> > > > _______________________________________________<br>
> > <br>
> > <br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>