Allow 'use_media_transport' to be modified on PeerConnection before local/remote description are set.
Downstream clients will be able to use GetConfiguration() and SetConfiguration() to enable MediaTransport. Bug: webrtc:9719 Change-Id: Ica77b25222732df211dc492dac848342d3f90ff2 Reviewed-on: https://webrtc-review.googlesource.com/c/106423 Commit-Queue: Peter Slatala <psla@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25221}
This commit is contained in:
parent
da65ed2adc
commit
aa1e7c284e
@ -2885,6 +2885,20 @@ bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration,
|
||||
return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error);
|
||||
}
|
||||
|
||||
if (local_description() &&
|
||||
configuration.use_media_transport != configuration_.use_media_transport) {
|
||||
RTC_LOG(LS_ERROR) << "Can't change media_transport after calling "
|
||||
"SetLocalDescription.";
|
||||
return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error);
|
||||
}
|
||||
|
||||
if (remote_description() &&
|
||||
configuration.use_media_transport != configuration_.use_media_transport) {
|
||||
RTC_LOG(LS_ERROR) << "Can't change media_transport after calling "
|
||||
"SetRemoteDescription.";
|
||||
return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error);
|
||||
}
|
||||
|
||||
// The simplest (and most future-compatible) way to tell if the config was
|
||||
// modified in an invalid way is to copy each property we do support
|
||||
// modifying, then use operator==. There are far more properties we don't
|
||||
@ -2909,6 +2923,7 @@ bool PeerConnection::SetConfiguration(const RTCConfiguration& configuration,
|
||||
modified_config.network_preference = configuration.network_preference;
|
||||
modified_config.active_reset_srtp_params =
|
||||
configuration.active_reset_srtp_params;
|
||||
modified_config.use_media_transport = configuration.use_media_transport;
|
||||
if (configuration != modified_config) {
|
||||
RTC_LOG(LS_ERROR) << "Modifying the configuration in an unsupported way.";
|
||||
return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error);
|
||||
|
||||
@ -1428,11 +1428,13 @@ TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterSetConfiguration) {
|
||||
|
||||
PeerConnectionInterface::RTCConfiguration config = pc_->GetConfiguration();
|
||||
config.type = PeerConnectionInterface::kRelay;
|
||||
config.use_media_transport = true;
|
||||
EXPECT_TRUE(pc_->SetConfiguration(config));
|
||||
|
||||
PeerConnectionInterface::RTCConfiguration returned_config =
|
||||
pc_->GetConfiguration();
|
||||
EXPECT_EQ(PeerConnectionInterface::kRelay, returned_config.type);
|
||||
EXPECT_TRUE(returned_config.use_media_transport);
|
||||
}
|
||||
|
||||
TEST_P(PeerConnectionInterfaceTest, SetConfigurationFailsAfterClose) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user