Switch to exception_ptr for async exceptions

This commit is contained in:
badaix 2020-03-12 23:33:10 +01:00
parent 5e508cae2e
commit d49b5c251c
5 changed files with 24 additions and 36 deletions

View file

@ -117,16 +117,10 @@ void Stream::clearChunks()
void Stream::addChunk(unique_ptr<msg::PcmChunk> chunk)
{
// drop chunks that should have been played 10s before. Just in case, this shouldn't happen.
while (!chunks_.empty())
{
auto first_chunk = chunks_.front();
cs::usec age = std::chrono::duration_cast<cs::usec>(TimeProvider::serverNow() - first_chunk->start());
if (age > 10s + bufferMs_)
chunks_.pop();
else
break;
}
// drop chunk if it's too old. Just in case, this shouldn't happen.
cs::usec age = std::chrono::duration_cast<cs::usec>(TimeProvider::serverNow() - chunk->start());
if (age > 5s + bufferMs_)
return;
// LOG(DEBUG, LOG_TAG) << "new chunk: " << chunk->durationMs() << " ms, Chunks: " << chunks_.size() << "\n";