diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc index 47f858e272..18d921c979 100644 --- a/p2p/base/p2p_transport_channel.cc +++ b/p2p/base/p2p_transport_channel.cc @@ -775,6 +775,16 @@ void P2PTransportChannel::SetIceConfig(const IceConfig& config) { ice_controller_->SetIceConfig(config_); + // DSCP override, allow user to specify (any) int value + // that will be used for tagging all packets. + webrtc::StructParametersParser::Create("override_dscp", + &field_trials_.override_dscp) + ->Parse(webrtc::field_trial::FindFullName("WebRTC-DscpFieldTrial")); + + if (field_trials_.override_dscp) { + SetOption(rtc::Socket::OPT_DSCP, *field_trials_.override_dscp); + } + RTC_DCHECK(ValidateIceConfig(config_).ok()); } @@ -1529,6 +1539,10 @@ void P2PTransportChannel::RememberRemoteCandidate( // port objects. int P2PTransportChannel::SetOption(rtc::Socket::Option opt, int value) { RTC_DCHECK_RUN_ON(network_thread_); + if (field_trials_.override_dscp && opt == rtc::Socket::OPT_DSCP) { + value = *field_trials_.override_dscp; + } + OptionMap::iterator it = options_.find(opt); if (it == options_.end()) { options_.insert(std::make_pair(opt, value)); diff --git a/p2p/base/p2p_transport_channel_ice_field_trials.h b/p2p/base/p2p_transport_channel_ice_field_trials.h index 4987f1cbcb..f05623dd36 100644 --- a/p2p/base/p2p_transport_channel_ice_field_trials.h +++ b/p2p/base/p2p_transport_channel_ice_field_trials.h @@ -61,6 +61,9 @@ struct IceFieldTrials { // Stop gathering when having a strong connection. bool stop_gather_on_strongly_connected = true; + + // DSCP taging. + absl::optional override_dscp; }; } // namespace cricket