mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-09 06:11:45 +02:00
Making the amount of silence played configurable as dryout_ms.
This commit is contained in:
parent
f49a2f1bb0
commit
50381bacaf
4 changed files with 8 additions and 2 deletions
|
@ -50,6 +50,11 @@ PcmStream::PcmStream(PcmListener* pcmListener, const StreamUri& uri) :
|
||||||
|
|
||||||
if (uri_.query.find("buffer_ms") != uri_.query.end())
|
if (uri_.query.find("buffer_ms") != uri_.query.end())
|
||||||
pcmReadMs_ = cpt::stoul(uri_.query["buffer_ms"]);
|
pcmReadMs_ = cpt::stoul(uri_.query["buffer_ms"]);
|
||||||
|
|
||||||
|
if (uri_.query.find("dryout_ms") != uri_.query.end())
|
||||||
|
dryoutMs_ = cpt::stoul(uri_.query["dryout_ms"]);
|
||||||
|
else
|
||||||
|
dryoutMs_ = 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ protected:
|
||||||
StreamUri uri_;
|
StreamUri uri_;
|
||||||
SampleFormat sampleFormat_;
|
SampleFormat sampleFormat_;
|
||||||
size_t pcmReadMs_;
|
size_t pcmReadMs_;
|
||||||
|
size_t dryoutMs_;
|
||||||
std::unique_ptr<Encoder> encoder_;
|
std::unique_ptr<Encoder> encoder_;
|
||||||
std::string name_;
|
std::string name_;
|
||||||
ReaderState state_;
|
ReaderState state_;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void PipeStream::worker()
|
||||||
tvEncodedChunk_ = tvChunk;
|
tvEncodedChunk_ = tvChunk;
|
||||||
long nextTick = chronos::getTickCount();
|
long nextTick = chronos::getTickCount();
|
||||||
int idleFrames = 0;
|
int idleFrames = 0;
|
||||||
int maxIdleFrames = sampleFormat_.rate*2;
|
int maxIdleFrames = sampleFormat_.rate*dryoutMs_/1000;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (fd_ == -1)
|
if (fd_ == -1)
|
||||||
|
|
|
@ -159,7 +159,7 @@ void ProcessStream::worker()
|
||||||
tvEncodedChunk_ = tvChunk;
|
tvEncodedChunk_ = tvChunk;
|
||||||
long nextTick = chronos::getTickCount();
|
long nextTick = chronos::getTickCount();
|
||||||
int idleFrames = 0;
|
int idleFrames = 0;
|
||||||
int maxIdleFrames = sampleFormat_.rate*2;
|
int maxIdleFrames = sampleFormat_.rate*dryoutMs_/1000;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while (active_)
|
while (active_)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue