Revert "Reland: Remove unsupported configuration value, allow_codec_switching"

This reverts commit 23501a2aa6.

Reason for revert: Breaks downstream features

Original change's description:
> Reland: Remove unsupported configuration value, `allow_codec_switching`
>
> This reverts commit 6b0c5babe0.
>
> Reason for revert: Relanding once downstream issues have been addressed
>
> Original change's description:
> > Revert "Remove unsupported configuration value, `allow_codec_switching`"
> >
> > This reverts commit 8f7a17f80f.
> >
> > Reason for revert: breaks downstream
> >
> > Original change's description:
> > > Remove unsupported configuration value, `allow_codec_switching`
> > >
> > > Bug: webrtc:11341
> > > Change-Id: I8ff598848996bd63ccc572e11f8f69c892a4a459
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324284
> > > Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> > > Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> > > Cr-Commit-Position: refs/heads/main@{#40995}
> >
> > Bug: webrtc:11341
> > Change-Id: I784fd95062fc71f8dcc139b05121985f60709004
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324780
> > Owners-Override: Philip Eliasson <philipel@webrtc.org>
> > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> > Commit-Queue: Philip Eliasson <philipel@webrtc.org>
> > Cr-Commit-Position: refs/heads/main@{#40998}
>
> Bug: webrtc:11341
> Change-Id: I3cb3e699fd76942c51f0f42a99bcb19ac607632e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324782
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41032}

Bug: webrtc:11341
Change-Id: I0eb8e6a464a8a51e6359caf8f43231dc275c4f20
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327382
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41161}
This commit is contained in:
Tomas Gunnarsson 2023-11-15 06:49:20 +00:00 committed by WebRTC LUCI CQ
parent 86944c40b3
commit 117d847901
6 changed files with 32 additions and 0 deletions

View file

@ -666,6 +666,10 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// Added to be able to control rollout of this feature. // Added to be able to control rollout of this feature.
bool enable_implicit_rollback = false; bool enable_implicit_rollback = false;
// Whether network condition based codec switching is allowed.
// TODO(bugs.webrtc.org/11341): Remove this unsupported config value.
absl::optional<bool> allow_codec_switching;
// The delay before doing a usage histogram report for long-lived // The delay before doing a usage histogram report for long-lived
// PeerConnections. Used for testing only. // PeerConnections. Used for testing only.
absl::optional<int> report_usage_pattern_delay_ms; absl::optional<int> report_usage_pattern_delay_ms;

View file

@ -329,6 +329,7 @@ RTCErrorOr<PeerConnectionInterface::RTCConfiguration> ApplyConfiguration(
modified_config.active_reset_srtp_params = modified_config.active_reset_srtp_params =
configuration.active_reset_srtp_params; configuration.active_reset_srtp_params;
modified_config.turn_logging_id = configuration.turn_logging_id; modified_config.turn_logging_id = configuration.turn_logging_id;
modified_config.allow_codec_switching = configuration.allow_codec_switching;
modified_config.stable_writable_connection_ping_interval_ms = modified_config.stable_writable_connection_ping_interval_ms =
configuration.stable_writable_connection_ping_interval_ms; configuration.stable_writable_connection_ping_interval_ms;
if (configuration != modified_config) { if (configuration != modified_config) {
@ -457,6 +458,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
bool offer_extmap_allow_mixed; bool offer_extmap_allow_mixed;
std::string turn_logging_id; std::string turn_logging_id;
bool enable_implicit_rollback; bool enable_implicit_rollback;
absl::optional<bool> allow_codec_switching;
absl::optional<int> report_usage_pattern_delay_ms; absl::optional<int> report_usage_pattern_delay_ms;
absl::optional<int> stable_writable_connection_ping_interval_ms; absl::optional<int> stable_writable_connection_ping_interval_ms;
VpnPreference vpn_preference; VpnPreference vpn_preference;
@ -520,6 +522,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
offer_extmap_allow_mixed == o.offer_extmap_allow_mixed && offer_extmap_allow_mixed == o.offer_extmap_allow_mixed &&
turn_logging_id == o.turn_logging_id && turn_logging_id == o.turn_logging_id &&
enable_implicit_rollback == o.enable_implicit_rollback && enable_implicit_rollback == o.enable_implicit_rollback &&
allow_codec_switching == o.allow_codec_switching &&
report_usage_pattern_delay_ms == o.report_usage_pattern_delay_ms && report_usage_pattern_delay_ms == o.report_usage_pattern_delay_ms &&
stable_writable_connection_ping_interval_ms == stable_writable_connection_ping_interval_ms ==
o.stable_writable_connection_ping_interval_ms && o.stable_writable_connection_ping_interval_ms &&

View file

@ -540,6 +540,11 @@ public class PeerConnection {
// every offer/answer negotiation.This is only intended to be a workaround for crbug.com/835958 // every offer/answer negotiation.This is only intended to be a workaround for crbug.com/835958
public boolean activeResetSrtpParams; public boolean activeResetSrtpParams;
// Whether this client is allowed to switch encoding codec mid-stream. This is a workaround for
// a WebRTC bug where the receiver could get confussed if a codec switch happened mid-call.
// Null indicates no change to currently configured value.
@Nullable public Boolean allowCodecSwitching;
/** /**
* Defines advanced optional cryptographic settings related to SRTP and * Defines advanced optional cryptographic settings related to SRTP and
* frame encryption for native WebRTC. Setting this will overwrite any * frame encryption for native WebRTC. Setting this will overwrite any
@ -606,6 +611,7 @@ public class PeerConnection {
activeResetSrtpParams = false; activeResetSrtpParams = false;
cryptoOptions = null; cryptoOptions = null;
turnLoggingId = null; turnLoggingId = null;
allowCodecSwitching = null;
enableImplicitRollback = false; enableImplicitRollback = false;
offerExtmapAllowMixed = true; offerExtmapAllowMixed = true;
} }
@ -795,6 +801,12 @@ public class PeerConnection {
return activeResetSrtpParams; return activeResetSrtpParams;
} }
@Nullable
@CalledByNative("RTCConfiguration")
Boolean getAllowCodecSwitching() {
return allowCodecSwitching;
}
@Nullable @Nullable
@CalledByNative("RTCConfiguration") @CalledByNative("RTCConfiguration")
CryptoOptions getCryptoOptions() { CryptoOptions getCryptoOptions() {

View file

@ -267,6 +267,10 @@ void JavaToNativeRTCConfiguration(
Java_RTCConfiguration_getActiveResetSrtpParams(jni, j_rtc_config); Java_RTCConfiguration_getActiveResetSrtpParams(jni, j_rtc_config);
rtc_config->crypto_options = rtc_config->crypto_options =
JavaToNativeOptionalCryptoOptions(jni, j_crypto_options); JavaToNativeOptionalCryptoOptions(jni, j_crypto_options);
rtc_config->allow_codec_switching = JavaToNativeOptionalBool(
jni, Java_RTCConfiguration_getAllowCodecSwitching(jni, j_rtc_config));
rtc_config->offer_extmap_allow_mixed = rtc_config->offer_extmap_allow_mixed =
Java_RTCConfiguration_getOfferExtmapAllowMixed(jni, j_rtc_config); Java_RTCConfiguration_getOfferExtmapAllowMixed(jni, j_rtc_config);
rtc_config->enable_implicit_rollback = rtc_config->enable_implicit_rollback =

View file

@ -184,6 +184,12 @@ RTC_OBJC_EXPORT
*/ */
@property(nonatomic, assign) BOOL activeResetSrtpParams; @property(nonatomic, assign) BOOL activeResetSrtpParams;
/** If the remote side support mid-stream codec switches then allow encoder
* switching to be performed.
*/
@property(nonatomic, assign) BOOL allowCodecSwitching;
/** /**
* Defines advanced optional cryptographic settings related to SRTP and * Defines advanced optional cryptographic settings related to SRTP and
* frame encryption for native WebRTC. Setting this will overwrite any * frame encryption for native WebRTC. Setting this will overwrite any

View file

@ -51,6 +51,7 @@
@synthesize sdpSemantics = _sdpSemantics; @synthesize sdpSemantics = _sdpSemantics;
@synthesize turnCustomizer = _turnCustomizer; @synthesize turnCustomizer = _turnCustomizer;
@synthesize activeResetSrtpParams = _activeResetSrtpParams; @synthesize activeResetSrtpParams = _activeResetSrtpParams;
@synthesize allowCodecSwitching = _allowCodecSwitching;
@synthesize cryptoOptions = _cryptoOptions; @synthesize cryptoOptions = _cryptoOptions;
@synthesize turnLoggingId = _turnLoggingId; @synthesize turnLoggingId = _turnLoggingId;
@synthesize rtcpAudioReportIntervalMs = _rtcpAudioReportIntervalMs; @synthesize rtcpAudioReportIntervalMs = _rtcpAudioReportIntervalMs;
@ -138,6 +139,7 @@
_turnLoggingId = [NSString stringWithUTF8String:config.turn_logging_id.c_str()]; _turnLoggingId = [NSString stringWithUTF8String:config.turn_logging_id.c_str()];
_rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms(); _rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms();
_rtcpVideoReportIntervalMs = config.video_rtcp_report_interval_ms(); _rtcpVideoReportIntervalMs = config.video_rtcp_report_interval_ms();
_allowCodecSwitching = config.allow_codec_switching.value_or(false);
_enableImplicitRollback = config.enable_implicit_rollback; _enableImplicitRollback = config.enable_implicit_rollback;
_offerExtmapAllowMixed = config.offer_extmap_allow_mixed; _offerExtmapAllowMixed = config.offer_extmap_allow_mixed;
_iceCheckIntervalStrongConnectivity = _iceCheckIntervalStrongConnectivity =
@ -284,6 +286,7 @@
nativeConfig->turn_logging_id = [_turnLoggingId UTF8String]; nativeConfig->turn_logging_id = [_turnLoggingId UTF8String];
nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs); nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs);
nativeConfig->set_video_rtcp_report_interval_ms(_rtcpVideoReportIntervalMs); nativeConfig->set_video_rtcp_report_interval_ms(_rtcpVideoReportIntervalMs);
nativeConfig->allow_codec_switching = _allowCodecSwitching;
nativeConfig->enable_implicit_rollback = _enableImplicitRollback; nativeConfig->enable_implicit_rollback = _enableImplicitRollback;
nativeConfig->offer_extmap_allow_mixed = _offerExtmapAllowMixed; nativeConfig->offer_extmap_allow_mixed = _offerExtmapAllowMixed;
if (_iceCheckIntervalStrongConnectivity != nil) { if (_iceCheckIntervalStrongConnectivity != nil) {