commit 31701a45aba7bfadafd8c556a812fc35e61f020f
parent a0911a12a1831d74112d830956c309c3db09ed66
Author: Dan Baker <dbaker@mozilla.com>
Date: Wed, 22 Oct 2025 13:24:41 -0600
Bug 1995393 - Vendor libwebrtc from b75874e802
Upstream commit: https://webrtc.googlesource.com/src/+/b75874e802d12951fac83f1cb641648957c86f87
api: make CryptoOptions non-optional
Bug: webrtc:42235111
Change-Id: I45997f7766a1a4ebddf283bcb6fe1b3d6c02dfba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/401700
Reviewed-by: Sameer Vijaykar <samvi@google.com>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45274}
Diffstat:
6 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-22T19:21:41.059972+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-22T19:24:31.253445+00:00.
# base of lastest vendoring
-76ed738ec2
+b75874e802
diff --git a/third_party/libwebrtc/api/peer_connection_interface.h b/third_party/libwebrtc/api/peer_connection_interface.h
@@ -660,16 +660,11 @@ class RTC_EXPORT PeerConnectionInterface : public RefCountInterface {
// Defines advanced optional cryptographic settings related to SRTP and
// frame encryption for native WebRTC.
- std::optional<CryptoOptions> crypto_options;
+ CryptoOptions crypto_options;
// TODO: bugs.webrtc.org/42235111 - remove after converting callers that
// expect an optional.
- CryptoOptions& GetWritableCryptoOptions() {
- if (!crypto_options) {
- crypto_options = CryptoOptions();
- }
- return *crypto_options;
- }
+ CryptoOptions& GetWritableCryptoOptions() { return crypto_options; }
// Configure if we should include the SDP attribute extmap-allow-mixed in
// our offer on session level.
diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc
@@ -404,7 +404,7 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
SdpSemantics sdp_semantics;
std::optional<AdapterType> network_preference;
bool active_reset_srtp_params;
- std::optional<CryptoOptions> crypto_options;
+ CryptoOptions crypto_options;
bool offer_extmap_allow_mixed;
std::string turn_logging_id;
bool enable_implicit_rollback;
@@ -687,9 +687,7 @@ JsepTransportController* PeerConnection::InitializeTransportController_n(
config.disable_encryption = options_.disable_encryption;
config.bundle_policy = configuration.bundle_policy;
config.rtcp_mux_policy = configuration.rtcp_mux_policy;
- config.crypto_options = configuration.crypto_options.has_value()
- ? *configuration.crypto_options
- : CryptoOptions();
+ config.crypto_options = configuration.crypto_options;
// Maybe enable PQC from FieldTrials
config.crypto_options.ephemeral_key_exchange_cipher_groups.Update(
@@ -1494,8 +1492,7 @@ RTCError PeerConnection::SetConfiguration(
}
if (has_local_description &&
- configuration.crypto_options.value_or(CryptoOptions()) !=
- configuration_.crypto_options) {
+ configuration.crypto_options != configuration_.crypto_options) {
LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_MODIFICATION,
"Can't change crypto_options after calling "
"SetLocalDescription.");
@@ -2973,10 +2970,7 @@ RTCError PeerConnection::StartSctpTransport(const SctpOptions& options) {
CryptoOptions PeerConnection::GetCryptoOptions() {
RTC_DCHECK_RUN_ON(signaling_thread());
- if (!configuration_.crypto_options) {
- configuration_.crypto_options = CryptoOptions();
- }
- return *configuration_.crypto_options;
+ return configuration_.crypto_options;
}
void PeerConnection::ClearStatsCache() {
diff --git a/third_party/libwebrtc/pc/peer_connection.h b/third_party/libwebrtc/pc/peer_connection.h
@@ -413,9 +413,8 @@ class PeerConnection : public PeerConnectionInternal,
// `sctp_mid()` if set. Called as part of setting the local description.
RTCError StartSctpTransport(const SctpOptions& options) override;
- // Returns the CryptoOptions for this PeerConnection. This will always
- // return the RTCConfiguration.crypto_options if set and return a stock
- // configuration if nothing was set.
+ // Returns the CryptoOptions set as RTCConfiguration.crypto_options for this
+ // PeerConnection.
CryptoOptions GetCryptoOptions() override;
// Internal implementation for AddTransceiver family of methods. If
diff --git a/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCConfiguration.mm b/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCConfiguration.mm
@@ -131,17 +131,17 @@
[[self class] sdpSemanticsForNativeSdpSemantics:config.sdp_semantics];
_turnCustomizer = config.turn_customizer;
_activeResetSrtpParams = config.active_reset_srtp_params;
- if (config.crypto_options) {
- _cryptoOptions = [[RTC_OBJC_TYPE(RTCCryptoOptions) alloc]
- initWithSrtpEnableGcmCryptoSuites:config.crypto_options->srtp
- .enable_gcm_crypto_suites
- srtpEnableAes128Sha1_32CryptoCipher:
- config.crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher
- srtpEnableEncryptedRtpHeaderExtensions:
- config.crypto_options->srtp.enable_encrypted_rtp_header_extensions
- sframeRequireFrameEncryption:config.crypto_options->sframe
- .require_frame_encryption];
- }
+
+ _cryptoOptions = [[RTC_OBJC_TYPE(RTCCryptoOptions) alloc]
+ initWithSrtpEnableGcmCryptoSuites:config.crypto_options.srtp
+ .enable_gcm_crypto_suites
+ srtpEnableAes128Sha1_32CryptoCipher:
+ config.crypto_options.srtp.enable_aes128_sha1_32_crypto_cipher
+ srtpEnableEncryptedRtpHeaderExtensions:
+ config.crypto_options.srtp.enable_encrypted_rtp_header_extensions
+ sframeRequireFrameEncryption:config.crypto_options.sframe
+ .require_frame_encryption];
+
_turnLoggingId =
[NSString stringWithUTF8String:config.turn_logging_id.c_str()];
_rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms();
@@ -298,8 +298,7 @@
_cryptoOptions.srtpEnableEncryptedRtpHeaderExtensions ? true : false;
nativeCryptoOptions.sframe.require_frame_encryption =
_cryptoOptions.sframeRequireFrameEncryption ? true : false;
- nativeConfig->crypto_options =
- std::optional<webrtc::CryptoOptions>(nativeCryptoOptions);
+ nativeConfig->crypto_options = nativeCryptoOptions;
}
nativeConfig->turn_logging_id = [_turnLoggingId UTF8String];
nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs);
diff --git a/third_party/libwebrtc/sdk/objc/unittests/RTCConfigurationTest.mm b/third_party/libwebrtc/sdk/objc/unittests/RTCConfigurationTest.mm
@@ -81,15 +81,14 @@
EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY,
nativeConfig->continual_gathering_policy);
EXPECT_EQ(true, nativeConfig->prune_turn_ports);
- EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_gcm_crypto_suites);
+ EXPECT_EQ(true, nativeConfig->crypto_options.srtp.enable_gcm_crypto_suites);
EXPECT_EQ(
true,
- nativeConfig->crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher);
- EXPECT_EQ(true,
- nativeConfig->crypto_options->srtp
- .enable_encrypted_rtp_header_extensions);
- EXPECT_EQ(true,
- nativeConfig->crypto_options->sframe.require_frame_encryption);
+ nativeConfig->crypto_options.srtp.enable_aes128_sha1_32_crypto_cipher);
+ EXPECT_EQ(
+ true,
+ nativeConfig->crypto_options.srtp.enable_encrypted_rtp_header_extensions);
+ EXPECT_EQ(true, nativeConfig->crypto_options.sframe.require_frame_encryption);
EXPECT_EQ(2500, nativeConfig->audio_rtcp_report_interval_ms());
EXPECT_EQ(3750, nativeConfig->video_rtcp_report_interval_ms());
}