Skip to content
Snippets Groups Projects
Commit e3073efd authored by Pierre Nicolas's avatar Pierre Nicolas :joy:
Browse files

call: fix mute participant

GitLab: #1089
Change-Id: I7f16e0ac1daca8a85770e778f350725fe54d2431
parent 38b55ed2
Branches
No related tags found
No related merge requests found
......@@ -1813,7 +1813,7 @@ Conference::unbindHostAudio()
}
// Unbind audio
if (source.label_ == sip_utils::DEFAULT_AUDIO_STREAMID) {
Manager::instance().getRingBufferPool().unBindAllHalfDuplexOut(RingBufferPool::DEFAULT_ID);
Manager::instance().getRingBufferPool().unBindAllHalfDuplexIn(RingBufferPool::DEFAULT_ID);
} else {
auto buffer = source.sourceUri_;
static const std::string& sep = libjami::Media::VideoProtocolPrefix::SEPARATOR;
......@@ -1821,7 +1821,7 @@ Conference::unbindHostAudio()
if (pos != std::string::npos)
buffer = source.sourceUri_.substr(pos + sep.size());
Manager::instance().getRingBufferPool().unBindAllHalfDuplexOut(buffer);
Manager::instance().getRingBufferPool().unBindAllHalfDuplexIn(buffer);
}
}
}
......@@ -1874,7 +1874,7 @@ Conference::unbindSubCallAudio(const std::string& callId)
auto medias = call->getAudioStreams();
auto& rbPool = Manager::instance().getRingBufferPool();
for (const auto& [id, muted] : medias) {
rbPool.unBindAllHalfDuplexOut(id);
rbPool.unBindAllHalfDuplexIn(id);
}
}
}
......
......@@ -65,6 +65,14 @@ RingBuffer::flushAll()
offset.second.offset = endPos_;
}
std::vector<std::string> RingBuffer::getSubscribers() {
std::vector<std::string> subscribers;
for (const auto &offset: readoffsets_) {
subscribers.push_back(offset.first);
}
return subscribers;
}
size_t
RingBuffer::putLength() const
{
......
......@@ -61,6 +61,12 @@ public:
void flushAll();
/**
* Return the list of subscribers (Ring buffers Id that are reading this ring buffer).
*/
std::vector<std::string>
getSubscribers();
inline AudioFormat getFormat() const { return format_; }
inline void setFormat(const AudioFormat& format)
......
......@@ -252,6 +252,17 @@ RingBufferPool::unBindAllHalfDuplexOut(const std::string& ringbufferId)
}
}
void
RingBufferPool::unBindAllHalfDuplexIn(const std::string &audioToDelete) {
std::lock_guard lk(stateLock_);
const std::shared_ptr<RingBuffer> &ringBuffer = getRingBuffer(audioToDelete);
const std::vector<std::string> &subscribers = ringBuffer->getSubscribers();
for (const auto &subscriber: subscribers) {
removeReaderFromRingBuffer(ringBuffer, subscriber);
}
}
void
RingBufferPool::unBindAll(const std::string& ringbufferId)
{
......
......@@ -69,6 +69,7 @@ public:
void unBindHalfDuplexOut(const std::string& process_id, const std::string& ringbufferId);
void unBindAllHalfDuplexOut(const std::string& ringbufferId);
void unBindAllHalfDuplexIn(const std::string& ringbufferId);
void unBindAll(const std::string& ringbufferId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment