Bug 1269486: allow setting ICE controller only once. r=bwc

MozReview-Commit-ID: AXyNyTZH1Jt

--HG--
extra : rebase_source : c8951fd5ada36d5c8ca25568e276fcb8cce0fbfc
This commit is contained in:
Nils Ohlmeier [:drno] 2016-05-03 13:28:14 -07:00
Родитель 960af35678
Коммит cd54d864ed
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -276,6 +276,7 @@ NrIceCtx::NrIceCtx(const std::string& name,
gathering_state_(ICE_CTX_GATHER_INIT), gathering_state_(ICE_CTX_GATHER_INIT),
name_(name), name_(name),
offerer_(offerer), offerer_(offerer),
ice_controlling_set_(false),
streams_(), streams_(),
ctx_(nullptr), ctx_(nullptr),
peer_(nullptr), peer_(nullptr),
@ -703,10 +704,13 @@ void NrIceCtx::destroy_peer_ctx() {
} }
nsresult NrIceCtx::SetControlling(Controlling controlling) { nsresult NrIceCtx::SetControlling(Controlling controlling) {
if (!ice_controlling_set_) {
peer_->controlling = (controlling == ICE_CONTROLLING)? 1 : 0; peer_->controlling = (controlling == ICE_CONTROLLING)? 1 : 0;
ice_controlling_set_ = true;
MOZ_MTLOG(ML_DEBUG, "ICE ctx " << name_ << " setting controlling to" << MOZ_MTLOG(ML_DEBUG, "ICE ctx " << name_ << " setting controlling to" <<
controlling); controlling);
}
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -371,6 +371,7 @@ private:
GatheringState gathering_state_; GatheringState gathering_state_;
const std::string name_; const std::string name_;
bool offerer_; bool offerer_;
bool ice_controlling_set_;
std::vector<RefPtr<NrIceMediaStream> > streams_; std::vector<RefPtr<NrIceMediaStream> > streams_;
nr_ice_ctx *ctx_; nr_ice_ctx *ctx_;
nr_ice_peer_ctx *peer_; nr_ice_peer_ctx *peer_;