[pulseaudio-discuss] [PATCH 2/2] pacat: write as much as possible in one go

Ahmed S. Darwish darwish.07 at gmail.com
Wed Dec 28 17:20:15 UTC 2016


Welcome back ;-)

On Wed, Dec 28, 2016 at 04:09:55PM +0200, Tanu Kaskinen wrote:
>
> Previously pacat wrote at most pa_stream_writable_size() bytes at a
> time, now with this patch it can write more than that if there's more
> input data available. Writing in bigger chunks is potentially a bit more
> efficient.
> ---
>  src/utils/pacat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/utils/pacat.c b/src/utils/pacat.c
> index 4e1bbfc..5a000ae 100644
> --- a/src/utils/pacat.c
> +++ b/src/utils/pacat.c
> @@ -525,7 +525,7 @@ fail:
>  /* New data on STDIN **/
>  static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) {
>      uint8_t *buf = NULL;
> -    size_t writable, towrite, r;
> +    size_t writable = (size_t) -1, towrite, r;
>

pa_stream_writable_size() return values which matches the
required latency. Meanwhile pa_stream_begin_write(.., -1)
always returns 64K, regardless of latency sensetivities.

Is that advisable?

Also, can't read() block with such large values? I've not
any O_NONBLOCK flags in the pacat code.

thanks,

-- 
Darwish
http://darwish.chasingpointers.com


More information about the pulseaudio-discuss mailing list