report stream state

This commit is contained in:
badaix 2016-03-06 22:30:23 +01:00
parent cd2daa2cf9
commit 94629f9909
9 changed files with 79 additions and 12 deletions

View file

@ -76,7 +76,10 @@ void PipeReader::worker()
{
int count = read(fd_, chunk->payload + len, toRead - len);
if (count < 0)
{
setState(kIdle);
usleep(100*1000);
}
else if (count == 0)
throw SnapException("end of file");
else
@ -92,6 +95,7 @@ void PipeReader::worker()
if (nextTick >= currentTick)
{
// logO << "sleep: " << nextTick - currentTick << "\n";
setState(kPlaying);
usleep((nextTick - currentTick) * 1000);
}
else