void OneToManyProcessor::removeSubscriber(const std::string& peerId) { ELOG_DEBUG("Remove subscriber %s", peerId.c_str()); boost::mutex::scoped_lock lock(monitor_mutex_); if (this->subscribers.find(peerId) != subscribers.end()) { deleteAsync(std::dynamic_pointer_cast<WebRtcConnection>(subscribers.find(peerId)->second)); this->subscribers.erase(peerId); } }
void OneToManyProcessor::closeAll() { ELOG_DEBUG("OneToManyProcessor closeAll"); feedbackSink_ = nullptr; if (publisher.get()) { std::future<void> future = deleteAsync(std::dynamic_pointer_cast<WebRtcConnection>(publisher)); future.wait(); } publisher.reset(); boost::unique_lock<boost::mutex> lock(monitor_mutex_); std::map<std::string, std::shared_ptr<MediaSink>>::iterator it = subscribers.begin(); while (it != subscribers.end()) { if ((*it).second != nullptr) { FeedbackSource* fbsource = (*it).second->getFeedbackSource(); std::future<void> future = deleteAsync(std::dynamic_pointer_cast<WebRtcConnection>((*it).second)); future.wait(); if (fbsource != nullptr) { fbsource->setFeedbackSink(nullptr); } } subscribers.erase(it++); } subscribers.clear(); ELOG_DEBUG("ClosedAll media in this OneToMany"); }
void SharedObject::ThreadedScope::destroySharedObject (SharedObject* const object) { deleteAsync (object); }