Making the amount of silence played configurable as dryout_ms.

This commit is contained in:
Tommy Goode 2017-10-08 23:09:48 -05:00 committed by Johannes Pohl
parent f49a2f1bb0
commit 50381bacaf
4 changed files with 8 additions and 2 deletions

View file

@ -50,6 +50,11 @@ PcmStream::PcmStream(PcmListener* pcmListener, const StreamUri& uri) :
if (uri_.query.find("buffer_ms") != uri_.query.end())
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;
}

View file

@ -100,6 +100,7 @@ protected:
StreamUri uri_;
SampleFormat sampleFormat_;
size_t pcmReadMs_;
size_t dryoutMs_;
std::unique_ptr<Encoder> encoder_;
std::string name_;
ReaderState state_;

View file

@ -73,7 +73,7 @@ void PipeStream::worker()
tvEncodedChunk_ = tvChunk;
long nextTick = chronos::getTickCount();
int idleFrames = 0;
int maxIdleFrames = sampleFormat_.rate*2;
int maxIdleFrames = sampleFormat_.rate*dryoutMs_/1000;
try
{
if (fd_ == -1)

View file

@ -159,7 +159,7 @@ void ProcessStream::worker()
tvEncodedChunk_ = tvChunk;
long nextTick = chronos::getTickCount();
int idleFrames = 0;
int maxIdleFrames = sampleFormat_.rate*2;
int maxIdleFrames = sampleFormat_.rate*dryoutMs_/1000;
try
{
while (active_)