From 9508eba62ed8efc7c5a31e032749ba8019eca461 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Tue, 7 Oct 2014 19:55:28 +0200 Subject: [PATCH] Return silence if the pipe read was blocked (credit bfitz) --- src/pipe.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pipe.c b/src/pipe.c index 25e39ddb..c8c9660d 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -108,14 +108,15 @@ pipe_audio_get(struct evbuffer *evbuf, int wanted) got = read(g_fd, g_buf, wanted); - if (got < 0) + if ((got < 0) && (errno != EAGAIN)) { DPRINTF(E_LOG, L_PLAYER, "Could not read from pipe: %s\n", strerror(errno)); return -1; } - // If the other end of the pipe is not writing we just return silence - if (got == 0) + // If the other end of the pipe is not writing or the read was blocked, + // we just return silence + if (got <= 0) { memset(g_buf, 0, wanted); got = wanted;