mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-09 22:31:55 +02:00
fix dry out time
This commit is contained in:
parent
1a51833f0e
commit
27baee7994
2 changed files with 14 additions and 12 deletions
|
@ -158,8 +158,8 @@ void ProcessStream::worker()
|
|||
chronos::systemtimeofday(&tvChunk);
|
||||
tvEncodedChunk_ = tvChunk;
|
||||
long nextTick = chronos::getTickCount();
|
||||
int idleFrames = 0;
|
||||
int maxIdleFrames = sampleFormat_.rate*dryoutMs_/1000;
|
||||
int idleBytes = 0;
|
||||
int maxIdleBytes = sampleFormat_.rate*sampleFormat_.frameSize*dryoutMs_/1000;
|
||||
try
|
||||
{
|
||||
while (active_)
|
||||
|
@ -171,10 +171,10 @@ void ProcessStream::worker()
|
|||
do
|
||||
{
|
||||
int count = read(process_->getStdout(), chunk->payload + len, toRead - len);
|
||||
if (count < 0 && idleFrames < maxIdleFrames)
|
||||
if (count < 0 && idleBytes < maxIdleBytes)
|
||||
{
|
||||
memset(chunk->payload + len, 0, toRead - len);
|
||||
idleFrames += toRead - len;
|
||||
idleBytes += toRead - len;
|
||||
len += toRead - len;
|
||||
continue;
|
||||
}
|
||||
|
@ -186,9 +186,10 @@ void ProcessStream::worker()
|
|||
}
|
||||
else if (count == 0)
|
||||
throw SnapException("end of file");
|
||||
else {
|
||||
else
|
||||
{
|
||||
len += count;
|
||||
idleFrames = 0;
|
||||
idleBytes = 0;
|
||||
}
|
||||
}
|
||||
while ((len < toRead) && active_);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue