Return silence if the pipe read was blocked (credit bfitz)

This commit is contained in:
ejurgensen 2014-10-07 19:55:28 +02:00
parent d61dc295e8
commit 9508eba62e

View File

@ -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;