mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 16:16:42 +02:00
Rename onChunkRead to onNewChunk
This commit is contained in:
parent
01ce9a60c0
commit
ed0521a1d2
7 changed files with 16 additions and 5 deletions
|
@ -133,13 +133,21 @@ void PcmStream::onChunkEncoded(const encoder::Encoder* /*encoder*/, std::shared_
|
|||
if (duration <= 0)
|
||||
return;
|
||||
|
||||
// absolute start timestamp is the tvEncodedChunk_
|
||||
auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(tvEncodedChunk_.time_since_epoch()).count();
|
||||
chunk->timestamp.sec = microsecs / 1000000;
|
||||
chunk->timestamp.usec = microsecs % 1000000;
|
||||
|
||||
// update tvEncodedChunk_ to the next chunk start by adding the current chunk duration
|
||||
tvEncodedChunk_ += std::chrono::nanoseconds(static_cast<std::chrono::nanoseconds::rep>(duration * 1000000));
|
||||
if (pcmListener_)
|
||||
pcmListener_->onChunkRead(this, chunk, duration);
|
||||
pcmListener_->onNewChunk(this, chunk, duration);
|
||||
}
|
||||
|
||||
|
||||
void PcmStream::onChunkRead(const msg::PcmChunk* chunk)
|
||||
{
|
||||
encoder_->encode(chunk);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue