mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-18 11:36:14 +02:00
Silence the PCM buffer if no chunk is available
This commit is contained in:
parent
147e4e9b7e
commit
168bc3f98b
7 changed files with 31 additions and 11 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "common/aixlog.hpp"
|
||||
#include "common/snap_exception.hpp"
|
||||
#include "common/str_compat.hpp"
|
||||
#include "common/utils/logging.hpp"
|
||||
#include "time_provider.hpp"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
@ -441,3 +442,16 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Stream::getPlayerChunkOrSilence(void* outputBuffer, const chronos::usec& outputBufferDacTime, uint32_t frames)
|
||||
{
|
||||
bool result = getPlayerChunk(outputBuffer, outputBufferDacTime, frames);
|
||||
if (!result)
|
||||
{
|
||||
static utils::logging::TimeConditional cond(1s);
|
||||
LOG(DEBUG, LOG_TAG) << cond << "Failed to get chunk, returning silence\n";
|
||||
getSilentPlayerChunk(outputBuffer, frames);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue