[pulseaudio-discuss] [PATCH] tunnel-sink-new: Fix stale audio on resume
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Fri Jan 2 04:49:25 PST 2015
On Fri, 2015-01-02 at 18:13 +0530, Arun Raghavan wrote:
> On 2 January 2015 at 18:04, Tanu Kaskinen <tanu.kaskinen at linux.intel.com> wrote:
> > I noticed that when resuming the tunnel sink, there was a small amount
> > of previously played audio before the new audio started to play.
> > Normally that probably wouldn't be noticeable, because there would be
> > a few seconds of silence played before suspending the sink due to
> > inactivity, so the unwanted old audio would be just silence, but in my
> > configuration sinks are suspended immediately when there's nothing
> > playing to them, so the glitch becomes audible.
> > ---
> > src/modules/module-tunnel-sink-new.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c
> > index 7d3bd99..1b3858d 100644
> > --- a/src/modules/module-tunnel-sink-new.c
> > +++ b/src/modules/module-tunnel-sink-new.c
> > @@ -109,6 +109,15 @@ static void cork_stream(struct userdata *u, bool cork) {
> > pa_assert(u);
> > pa_assert(u->stream);
> >
> > + if (cork) {
> > + /* When the sink becomes suspended (which is the only case where we
> > + * cork the stream), we don't want to keep any old data around, because
> > + * the old data is most likely unrelated to the audio that will be
> > + * played at the time when the sink starts running again. */
> > + if ((operation = pa_stream_flush(u->stream, NULL, NULL)))
> > + pa_operation_unref(operation);
> > + }
> > +
> > if ((operation = pa_stream_cork(u->stream, cork, NULL, NULL)))
> > pa_operation_unref(operation);
> > }
>
> Looks good to me.
Thanks, pushed.
--
Tanu
More information about the pulseaudio-discuss
mailing list