Add check for media transport and bundle policy
Bug: None
Change-Id: I36931774438b80ce391e656b8db2f2bb6ed25d8b
Reviewed-on: https://webrtc-review.googlesource.com/c/110961
Commit-Queue: Peter Slatala <psla@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Anton Sukhanov <sukhanov@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25733}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index 3b9b9c8..e60474c 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -2997,6 +2997,12 @@
return SafeSetError(RTCErrorType::INVALID_MODIFICATION, error);
}
+ if (configuration.use_media_transport_for_data_channels ||
+ configuration.use_media_transport) {
+ RTC_CHECK(configuration.bundle_policy == kBundlePolicyMaxBundle)
+ << "Media transport requires MaxBundle policy.";
+ }
+
// 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
diff --git a/pc/peerconnectioninterface_unittest.cc b/pc/peerconnectioninterface_unittest.cc
index 362c851..fe8fd8d 100644
--- a/pc/peerconnectioninterface_unittest.cc
+++ b/pc/peerconnectioninterface_unittest.cc
@@ -1426,7 +1426,10 @@
// Check that GetConfiguration returns the last configuration passed into
// SetConfiguration.
TEST_P(PeerConnectionInterfaceTest, GetConfigurationAfterSetConfiguration) {
- CreatePeerConnection();
+ PeerConnectionInterface::RTCConfiguration starting_config;
+ starting_config.bundle_policy =
+ webrtc::PeerConnection::kBundlePolicyMaxBundle;
+ CreatePeerConnection(starting_config);
PeerConnectionInterface::RTCConfiguration config = pc_->GetConfiguration();
config.type = PeerConnectionInterface::kRelay;