stream_file: explicitly signal EOF

Explicitly signal EOF when reaching the end of a file/pipe.

Fixes a 4 second delay due to stream_reconnect for e.g.
echo | mplayer -

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35112 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2012-08-22 18:24:56 +00:00 committed by wm4
parent 5104699646
commit ff08d0c34a
1 changed files with 2 additions and 0 deletions

View File

@ -55,6 +55,8 @@ static const struct m_struct_st stream_opts = {
static int fill_buffer(stream_t *s, char* buffer, int max_len){
int r = read(s->fd,buffer,max_len);
// We are certain this is EOF, do not retry
if (max_len && r == 0) s->eof = 1;
return (r <= 0) ? -1 : r;
}