mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-28 16:36:17 +02:00
don't log repeated exceptions
This commit is contained in:
parent
9ec135e1b8
commit
8cf069642d
2 changed files with 16 additions and 3 deletions
|
@ -62,6 +62,7 @@ void PipeStream::worker()
|
||||||
{
|
{
|
||||||
timeval tvChunk;
|
timeval tvChunk;
|
||||||
std::unique_ptr<msg::PcmChunk> chunk(new msg::PcmChunk(sampleFormat_, pcmReadMs_));
|
std::unique_ptr<msg::PcmChunk> chunk(new msg::PcmChunk(sampleFormat_, pcmReadMs_));
|
||||||
|
string lastException = "";
|
||||||
|
|
||||||
while (active_)
|
while (active_)
|
||||||
{
|
{
|
||||||
|
@ -121,11 +122,17 @@ void PipeStream::worker()
|
||||||
pcmListener_->onResync(this, currentTick - nextTick);
|
pcmListener_->onResync(this, currentTick - nextTick);
|
||||||
nextTick = currentTick;
|
nextTick = currentTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastException = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
logE << "(PipeStream) Exception: " << e.what() << std::endl;
|
if (lastException != e.what())
|
||||||
|
{
|
||||||
|
logE << "(PipeStream) Exception: " << e.what() << std::endl;
|
||||||
|
lastException = e.what();
|
||||||
|
}
|
||||||
if (!sleep(100))
|
if (!sleep(100))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,8 +146,8 @@ void ProcessStream::worker()
|
||||||
{
|
{
|
||||||
timeval tvChunk;
|
timeval tvChunk;
|
||||||
std::unique_ptr<msg::PcmChunk> chunk(new msg::PcmChunk(sampleFormat_, pcmReadMs_));
|
std::unique_ptr<msg::PcmChunk> chunk(new msg::PcmChunk(sampleFormat_, pcmReadMs_));
|
||||||
|
|
||||||
setState(kPlaying);
|
setState(kPlaying);
|
||||||
|
string lastException = "";
|
||||||
|
|
||||||
while (active_)
|
while (active_)
|
||||||
{
|
{
|
||||||
|
@ -208,11 +208,17 @@ void ProcessStream::worker()
|
||||||
pcmListener_->onResync(this, currentTick - nextTick);
|
pcmListener_->onResync(this, currentTick - nextTick);
|
||||||
nextTick = currentTick;
|
nextTick = currentTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastException = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
logE << "(ProcessStream) Exception: " << e.what() << std::endl;
|
if (lastException != e.what())
|
||||||
|
{
|
||||||
|
logE << "(PipeStream) Exception: " << e.what() << std::endl;
|
||||||
|
lastException = e.what();
|
||||||
|
}
|
||||||
process_->kill();
|
process_->kill();
|
||||||
if (!sleep(30000))
|
if (!sleep(30000))
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue