Ejemplo n.º 1
0
  void OneToManyProcessor::addSubscriber(MediaSink* webRtcConn,
      const std::string& peerId) {
    ELOG_DEBUG("Adding subscriber");
    ELOG_DEBUG("From %u, %u ", publisher->getAudioSourceSSRC() , publisher->getVideoSourceSSRC());
    webRtcConn->setAudioSinkSSRC(this->publisher->getAudioSourceSSRC());
    webRtcConn->setVideoSinkSSRC(this->publisher->getVideoSourceSSRC());
    ELOG_DEBUG("Subscribers ssrcs: Audio %u, video, %u from %u, %u ", webRtcConn->getAudioSinkSSRC(), webRtcConn->getVideoSinkSSRC(), this->publisher->getAudioSourceSSRC() , this->publisher->getVideoSourceSSRC());
    FeedbackSource* fbsource = webRtcConn->getFeedbackSource();

    if (fbsource!=NULL){
      ELOG_DEBUG("adding fbsource");
      fbsource->setFeedbackSink(this);
    }
    this->subscribers[peerId] = webRtcConn;
  }
Ejemplo n.º 2
0
 void OneToManyProcessor::closeAll() {
   ELOG_DEBUG("OneToManyProcessor closeAll");
   feedbackSink_ = NULL;
   publisher.reset();
   boost::unique_lock<boost::mutex> lock(myMonitor_);
   std::map<std::string, boost::shared_ptr<MediaSink> >::iterator it = subscribers.begin();
   while (it != subscribers.end()) {
     if ((*it).second != NULL) {
       FeedbackSource* fbsource = (*it).second->getFeedbackSource();
       if (fbsource != NULL) {
         fbsource->setFeedbackSink(NULL);
       }
     }
     subscribers.erase(it++);
   }
   subscribers.clear();
   ELOG_DEBUG("ClosedAll media in this OneToMany");
 }
Ejemplo n.º 3
0
  void OneToManyProcessor::addSubscriber(MediaSink* webRtcConn,
      const std::string& peerId) {
    ELOG_DEBUG("Adding subscriber");
    boost::mutex::scoped_lock lock(myMonitor_);
    ELOG_DEBUG("From %u, %u ", publisher->getAudioSourceSSRC(), publisher->getVideoSourceSSRC());
    webRtcConn->setAudioSinkSSRC(this->publisher->getAudioSourceSSRC());
    webRtcConn->setVideoSinkSSRC(this->publisher->getVideoSourceSSRC());
    ELOG_DEBUG("Subscribers ssrcs: Audio %u, video, %u from %u, %u ",
               webRtcConn->getAudioSinkSSRC(), webRtcConn->getVideoSinkSSRC(),
               this->publisher->getAudioSourceSSRC() , this->publisher->getVideoSourceSSRC());
    FeedbackSource* fbsource = webRtcConn->getFeedbackSource();

    if (fbsource != NULL) {
      ELOG_DEBUG("adding fbsource");
      fbsource->setFeedbackSink(this);
    }
    if (this->subscribers.find(peerId) != subscribers.end()) {
        ELOG_WARN("This OTM already has a subscriber with peerId %s, substituting it", peerId.c_str());
        this->subscribers.erase(peerId);
    }
    this->subscribers[peerId] = sink_ptr(webRtcConn);
  }
Ejemplo n.º 4
0
 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");
 }