[input] Fix pipe playback bringing cpu to 100%

When pipe playback is started, but no data is written to the pipe, the input
loop would bring the cpu to 100%. This fix limits the loop like it was before
player refactor.
This commit is contained in:
ejurgensen
2019-08-28 22:23:11 +02:00
parent ef0a194644
commit ef9c0117c9
4 changed files with 45 additions and 42 deletions

View File

@@ -87,10 +87,6 @@ play(struct input_source *source)
int ret;
short flags;
ret = input_wait();
if (ret < 0)
return 0; // Loop, input_buffer is not ready for writing
// We set "wanted" to 1 because the read size doesn't matter to us
// TODO optimize?
ret = transcode(source->evbuf, &icy_timer, ctx, 1);

View File

@@ -872,10 +872,6 @@ play(struct input_source *source)
short flags;
int ret;
ret = input_wait();
if (ret < 0)
return 0; // Loop, input_buffer is not ready for writing
ret = evbuffer_read(source->evbuf, pipe->fd, PIPE_READ_MAX);
if ((ret == 0) && (pipe->is_autostarted))
{
@@ -885,6 +881,7 @@ play(struct input_source *source)
}
else if ((ret == 0) || ((ret < 0) && (errno == EAGAIN)))
{
input_wait();
return 0; // Loop
}
else if (ret < 0)