[pulseaudio-discuss] [PATCH 2/3] sink: Add some comments about the rewind handling during stream moves.

Maarten Bosmans mkbosmans at gmail.com
Thu Sep 29 14:36:48 PDT 2011


Warning bikeshed ahead.

2011/9/29 Tanu Kaskinen <tanu.kaskinen at digia.com>:
> ---
>  src/pulsecore/sink.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 58 insertions(+), 0 deletions(-)
>
> diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
> index a2642b4..53cab32 100644
> --- a/src/pulsecore/sink.c
> +++ b/src/pulsecore/sink.c
> @@ -2403,6 +2403,46 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse
>                 pa_usec_t usec = 0;
>                 size_t sink_nbytes, total_nbytes;
>
> +                /* The old sink probably has some audio from this
> +                 * stream in its buffer. We want to "take it back" as
> +                 * much as possible and play it to the new sink. We
> +                 * don't know at this point how much the old sink can
> +                 * rewind. We have to pick something, and that
> +                 * something is the full latency of the old sink here.
> +                 * So we rewind the stream buffer by the sink latency
> +                 * amount, which may be more than what we should
> +                 * rewind. This can result in a chunk of audio being
> +                 * played both to the old sink and the new sink.

I'd say that these comments can be a bit wider. Coding Style says
about 127 chars. That would be a bit much for a comment block IMHO,
but it would be good to conserve some vertical space here.

Oh, and thanks for addressing
http://www.ohloh.net/p/pulseaudio/factoids/10252254

Maarten


More information about the pulseaudio-discuss mailing list