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
No related branches found
No related tags found
No related merge requests found
...@@ -1813,7 +1813,7 @@ Conference::unbindHostAudio() ...@@ -1813,7 +1813,7 @@ Conference::unbindHostAudio()
} }
// Unbind audio // Unbind audio
if (source.label_ == sip_utils::DEFAULT_AUDIO_STREAMID) { if (source.label_ == sip_utils::DEFAULT_AUDIO_STREAMID) {
Manager::instance().getRingBufferPool().unBindAllHalfDuplexOut(RingBufferPool::DEFAULT_ID); Manager::instance().getRingBufferPool().unBindAllHalfDuplexIn(RingBufferPool::DEFAULT_ID);
} else { } else {
auto buffer = source.sourceUri_; auto buffer = source.sourceUri_;
static const std::string& sep = libjami::Media::VideoProtocolPrefix::SEPARATOR; static const std::string& sep = libjami::Media::VideoProtocolPrefix::SEPARATOR;
...@@ -1821,7 +1821,7 @@ Conference::unbindHostAudio() ...@@ -1821,7 +1821,7 @@ Conference::unbindHostAudio()
if (pos != std::string::npos) if (pos != std::string::npos)
buffer = source.sourceUri_.substr(pos + sep.size()); 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) ...@@ -1874,7 +1874,7 @@ Conference::unbindSubCallAudio(const std::string& callId)
auto medias = call->getAudioStreams(); auto medias = call->getAudioStreams();
auto& rbPool = Manager::instance().getRingBufferPool(); auto& rbPool = Manager::instance().getRingBufferPool();
for (const auto& [id, muted] : medias) { for (const auto& [id, muted] : medias) {
rbPool.unBindAllHalfDuplexOut(id); rbPool.unBindAllHalfDuplexIn(id);
} }
} }
} }
......
...@@ -65,6 +65,14 @@ RingBuffer::flushAll() ...@@ -65,6 +65,14 @@ RingBuffer::flushAll()
offset.second.offset = endPos_; 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 size_t
RingBuffer::putLength() const RingBuffer::putLength() const
{ {
......
...@@ -61,6 +61,12 @@ public: ...@@ -61,6 +61,12 @@ public:
void flushAll(); 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 AudioFormat getFormat() const { return format_; }
inline void setFormat(const AudioFormat& format) inline void setFormat(const AudioFormat& format)
......
...@@ -252,6 +252,17 @@ RingBufferPool::unBindAllHalfDuplexOut(const std::string& ringbufferId) ...@@ -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 void
RingBufferPool::unBindAll(const std::string& ringbufferId) RingBufferPool::unBindAll(const std::string& ringbufferId)
{ {
......
...@@ -69,6 +69,7 @@ public: ...@@ -69,6 +69,7 @@ public:
void unBindHalfDuplexOut(const std::string& process_id, const std::string& ringbufferId); void unBindHalfDuplexOut(const std::string& process_id, const std::string& ringbufferId);
void unBindAllHalfDuplexOut(const std::string& ringbufferId); void unBindAllHalfDuplexOut(const std::string& ringbufferId);
void unBindAllHalfDuplexIn(const std::string& ringbufferId);
void unBindAll(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.
Finish editing this message first!
Please register or to comment