bool MediaStream::setRemoteSdp(std::shared_ptr<SdpInfo> sdp) { ELOG_DEBUG("%s message: setting remote SDP", toLog()); if (!sending_) { return true; } remote_sdp_ = sdp; if (remote_sdp_->videoBandwidth != 0) { ELOG_DEBUG("%s message: Setting remote BW, maxVideoBW: %u", toLog(), remote_sdp_->videoBandwidth); this->rtcp_processor_->setMaxVideoBW(remote_sdp_->videoBandwidth*1000); } if (pipeline_initialized_) { pipeline_->notifyUpdate(); return true; } bundle_ = remote_sdp_->isBundle; auto video_ssrc_list_it = remote_sdp_->video_ssrc_map.find(getLabel()); if (video_ssrc_list_it != remote_sdp_->video_ssrc_map.end()) { setVideoSourceSSRCList(video_ssrc_list_it->second); } auto audio_ssrc_it = remote_sdp_->audio_ssrc_map.find(getLabel()); if (audio_ssrc_it != remote_sdp_->audio_ssrc_map.end()) { setAudioSourceSSRC(audio_ssrc_it->second); } if (getVideoSourceSSRCList().empty() || (getVideoSourceSSRCList().size() == 1 && getVideoSourceSSRCList()[0] == 0)) { std::vector<uint32_t> default_ssrc_list; default_ssrc_list.push_back(kDefaultVideoSinkSSRC); setVideoSourceSSRCList(default_ssrc_list); } if (getAudioSourceSSRC() == 0) { setAudioSourceSSRC(kDefaultAudioSinkSSRC); } audio_enabled_ = remote_sdp_->hasAudio; video_enabled_ = remote_sdp_->hasVideo; rtcp_processor_->addSourceSsrc(getAudioSourceSSRC()); std::for_each(video_source_ssrc_list_.begin(), video_source_ssrc_list_.end(), [this] (uint32_t new_ssrc){ rtcp_processor_->addSourceSsrc(new_ssrc); }); initializePipeline(); return true; }
bool MediaStream::setRemoteSdp(std::shared_ptr<SdpInfo> sdp) { ELOG_DEBUG("%s message: setting remote SDP", toLog()); remote_sdp_ = sdp; if (remote_sdp_->videoBandwidth != 0) { ELOG_DEBUG("%s message: Setting remote BW, maxVideoBW: %u", toLog(), remote_sdp_->videoBandwidth); this->rtcp_processor_->setMaxVideoBW(remote_sdp_->videoBandwidth*1000); } if (pipeline_initialized_) { pipeline_->notifyUpdate(); return true; } bundle_ = remote_sdp_->isBundle; setVideoSourceSSRCList(remote_sdp_->video_ssrc_list); setAudioSourceSSRC(remote_sdp_->audio_ssrc); audio_enabled_ = remote_sdp_->hasAudio; video_enabled_ = remote_sdp_->hasVideo; rtcp_processor_->addSourceSsrc(getAudioSourceSSRC()); std::for_each(video_source_ssrc_list_.begin(), video_source_ssrc_list_.end(), [this] (uint32_t new_ssrc){ rtcp_processor_->addSourceSsrc(new_ssrc); }); initializePipeline(); return true; }