[pulseaudio-discuss] [PATCH v10 1/3] pipe-source: implement autosuspend behavior

Georg Chini georg at chini.tk
Mon Apr 9 09:42:39 UTC 2018


On 20.03.2018 13:27, Raman Shyshniou wrote:
> Currently the pipe-source will remain running even if no
> writer is connected and therefore no data is produced.
> This patch prevents this by auto-suspending source
> when all writers are disconnected.

The series looks nearly good now, only two small comments remaining.

> @@ -102,16 +154,11 @@ static int source_process_msg(
>       switch (code) {
>   
>           case PA_SOURCE_MESSAGE_GET_LATENCY: {
> -            size_t n = 0;
> +            pa_usec_t now;
>   
> -#ifdef FIONREAD
> -            int l;
> +            now = pa_rtclock_now();
> +            *((int64_t*) data) = (int64_t)now - (int64_t)u->timestamp;
>   
> -            if (ioctl(u->fd, FIONREAD, &l) >= 0 && l > 0)
> -                n = (size_t) l;
> -#endif
> -
> -            *((int64_t*) data) = pa_bytes_to_usec(n, &u->source->sample_spec);
>               return 0;
>           }
>       }
It is possible, that the memchunk contains some data you have not posted
when you are resuming from auto suspend. So you have to add the data in
the memchunk to the latency.


More information about the pulseaudio-discuss mailing list