Adding GetConfiguration to PeerConnection.
Just returns the configuration the PC was constructed with, or the last
one passed into SetConfiguration.
BUG=chromium:587453
Review-Url: https://codereview.webrtc.org/2504103002
Cr-Commit-Position: refs/heads/master@{#15111}
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 2f320d7..a1ce6ab 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -636,8 +636,6 @@
stats_.reset(new StatsCollector(this));
stats_collector_ = RTCStatsCollector::Create(this);
- enable_ice_renomination_ = configuration.enable_ice_renomination;
-
// Initialize the WebRtcSession. It creates transport channels etc.
if (!session_->Initialize(factory_->options(), std::move(cert_generator),
configuration)) {
@@ -662,6 +660,8 @@
this, &PeerConnection::OnDataChannelDestroyed);
session_->SignalDataChannelOpenMessage.connect(
this, &PeerConnection::OnDataChannelOpenMessage);
+
+ configuration_ = configuration;
return true;
}
@@ -1262,8 +1262,14 @@
MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
}
+PeerConnectionInterface::RTCConfiguration PeerConnection::GetConfiguration() {
+ return configuration_;
+}
+
bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration) {
TRACE_EVENT0("webrtc", "PeerConnection::SetConfiguration");
+ // TODO(deadbeef): Return false and log an error if there are any unsupported
+ // modifications.
if (port_allocator_) {
if (!network_thread()->Invoke<bool>(
RTC_FROM_HERE,
@@ -1276,7 +1282,7 @@
// TODO(deadbeef): Shouldn't have to hop to the worker thread twice...
session_->SetIceConfig(session_->ParseIceConfig(configuration));
- enable_ice_renomination_ = configuration.enable_ice_renomination;
+ configuration_ = configuration;
return true;
}
@@ -1631,7 +1637,8 @@
cricket::TransportOptions();
}
}
- session_options->enable_ice_renomination = enable_ice_renomination_;
+ session_options->enable_ice_renomination =
+ configuration_.enable_ice_renomination;
if (!ExtractMediaSessionOptions(rtc_options, true, session_options)) {
return false;
@@ -1674,7 +1681,8 @@
cricket::MediaSessionOptions* session_options) {
session_options->recv_audio = false;
session_options->recv_video = false;
- session_options->enable_ice_renomination = enable_ice_renomination_;
+ session_options->enable_ice_renomination =
+ configuration_.enable_ice_renomination;
}
void PeerConnection::FinishOptionsForAnswer(