Skip to content
Snippets Groups Projects
Commit 3b998345 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ringbuffer: add write lock

Change-Id: Idde24be13daf0fca55ce5a2607e6b9835c18f3c5
parent 0623347c
No related branches found
No related tags found
No related merge requests found
......@@ -163,6 +163,7 @@ RingBuffer::hasNoReadOffsets() const
void
RingBuffer::put(std::shared_ptr<AudioFrame>&& data)
{
std::lock_guard<std::mutex> l(writeLock_);
resizer_.enqueue(resampler_.resample(std::move(data), format_));
}
......
......@@ -72,6 +72,7 @@ public:
inline void setFormat(const AudioFormat& format)
{
std::lock_guard<std::mutex> l(writeLock_);
format_ = format;
resizer_.setFormat(format, format.sample_rate / 50);
}
......@@ -201,6 +202,7 @@ private:
mutable std::mutex lock_;
mutable std::condition_variable not_empty_;
std::mutex writeLock_;
ReadOffsetMap readoffsets_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment