Allow receive-only use of datagram transport for data channels.
Adds a field trial and configuration parameter to control whether
datagram transport may be used for data channels in a receive-only
manner. By default, if use_datagram_transport_for_data_channels is
enabled, PeerConnection will create a datagram transport and offer its
use for outgoing calls as well as accept incoming offers with compatible
datagram transport parameters.
With this change, a receive_only mode is added for datagram transport
data channels. When receive_only is set, the PeerConnection will not
create or offer datagram transports for outgoing calls, but will accept
incoming calls that offer compatible datagram transport parameters.
Bug: webrtc:9719
Change-Id: I35667bcc408ea4bbc61155898e6d2472dd262711
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154463
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29327}
diff --git a/pc/peer_connection.h b/pc/peer_connection.h
index 393beed..c783ae9 100644
--- a/pc/peer_connection.h
+++ b/pc/peer_connection.h
@@ -365,8 +365,10 @@
// Field-trial based configuration for datagram transport data channels.
struct DatagramTransportDataChannelConfig {
explicit DatagramTransportDataChannelConfig(const std::string& field_trial)
- : enabled("enabled", true), default_value("default_value", false) {
- ParseFieldTrial({&enabled, &default_value}, field_trial);
+ : enabled("enabled", true),
+ default_value("default_value", false),
+ receive_only("receive_only", false) {
+ ParseFieldTrial({&enabled, &default_value, &receive_only}, field_trial);
}
// Whether datagram transport data channel support is enabled at all.
@@ -382,6 +384,11 @@
// applications will use the datagram transport by default (but may still
// explicitly configure themselves not to use it through RTCConfiguration).
FieldTrialFlag default_value;
+
+ // Whether the datagram transport is enabled in receive-only mode. If true,
+ // and if the datagram transport is enabled, it will only be used when
+ // receiving incoming calls, not when placing outgoing calls.
+ FieldTrialFlag receive_only;
};
// Implements MessageHandler.
@@ -1196,7 +1203,8 @@
const DatagramTransportConfig datagram_transport_config_;
// Field-trial based configuration for datagram transport data channels.
- const DatagramTransportConfig datagram_transport_data_channel_config_;
+ const DatagramTransportDataChannelConfig
+ datagram_transport_data_channel_config_;
// Final, resolved value for whether datagram transport is in use.
bool use_datagram_transport_ RTC_GUARDED_BY(signaling_thread()) = false;
@@ -1206,6 +1214,10 @@
bool use_datagram_transport_for_data_channels_
RTC_GUARDED_BY(signaling_thread()) = false;
+ // Resolved value of whether to use data channels only for incoming calls.
+ bool use_datagram_transport_for_data_channels_receive_only_
+ RTC_GUARDED_BY(signaling_thread()) = false;
+
// Cache configuration_.use_media_transport so that we can access it from
// other threads.
// TODO(bugs.webrtc.org/9987): Caching just this bool and allowing the data