mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 15:46:42 +02:00
stream notifies about new chunks
This commit is contained in:
parent
74dab4ca10
commit
446f2a2f34
4 changed files with 25 additions and 3 deletions
|
@ -74,10 +74,20 @@ void Stream::addChunk(msg::PcmChunk* chunk)
|
|||
while (chunks_.size() * chunk->duration<cs::msec>().count() > 10000)
|
||||
chunks_.pop();
|
||||
chunks_.push(shared_ptr<msg::PcmChunk>(chunk));
|
||||
std::unique_lock<std::mutex> lck(cvMutex_);
|
||||
cv_.notify_one();
|
||||
// logD << "new chunk: " << chunk_->getDuration() << ", Chunks: " << chunks_.size() << "\n";
|
||||
}
|
||||
|
||||
|
||||
bool Stream::waitForChunk(size_t ms) const
|
||||
{
|
||||
std::unique_lock<std::mutex> lck(cvMutex_);
|
||||
cv_.wait_for(lck, std::chrono::milliseconds(ms));
|
||||
return !chunks_.empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
cs::time_point_hrc Stream::getSilentPlayerChunk(void* outputBuffer, unsigned long framesPerBuffer)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue