commit 938f781ea7e0adcd72b61f1b5366d9c3241d3294 parent 2ad7af33c9de3cf35413f37089db3408c793244d Author: Dan Baker <dbaker@mozilla.com> Date: Mon, 1 Dec 2025 20:36:39 -0700 Bug 2000941 - Vendor libwebrtc from e4b65f8ebc Upstream commit: https://webrtc.googlesource.com/src/+/e4b65f8ebc2f18688202e49aa2dfbafc9aebc923 Use SessionDescriptionInterface::GetType instead of type() This patch migrates all internal call sites from the string-based SessionDescriptionInterface::type() method to the enum-based GetType(). The existing type() method is scheduled for deprecation. Marking `type()` as deprecated will need to wait a little longer however since downstream code needs to be updated first. - C++ tests and helpers now call GetType() and use SdpTypeToString for logging. - The Android JNI function NativeToJavaSessionDescription is modified to accept the SdpType enum instead of a std::string. - An Objective-C helper, typeForSdpType, is added to convert the C++ SdpType enum to the native RTCSdpType. Bug: none Change-Id: Ie08adb524da1ccae6dc70a215dea4708bbea4d7b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/409261 Commit-Queue: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Auto-Submit: Tomas Gunnarsson <tommi@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#45649} Diffstat:
6 files changed, 26 insertions(+), 9 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-12-02T03:33:42.004174+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T03:36:25.983609+00:00. # base of lastest vendoring -df2a9247c2 +e4b65f8ebc diff --git a/third_party/libwebrtc/pc/jsep_session_description_unittest.cc b/third_party/libwebrtc/pc/jsep_session_description_unittest.cc @@ -117,7 +117,7 @@ class JsepSessionDescriptionTest : public ::testing::Test { TEST_F(JsepSessionDescriptionTest, CloneDefault) { auto new_desc = jsep_desc_->Clone(); - EXPECT_EQ(jsep_desc_->type(), new_desc->type()); + EXPECT_EQ(jsep_desc_->GetType(), new_desc->GetType()); std::string old_desc_string; std::string new_desc_string; EXPECT_TRUE(jsep_desc_->ToString(&old_desc_string)); @@ -132,7 +132,7 @@ TEST_F(JsepSessionDescriptionTest, CloneRollback) { absl::StrCat(CreateRandomId64()), absl::StrCat(CreateRandomId64())); EXPECT_EQ(jsep_desc->GetType(), SdpType::kRollback); auto new_desc = jsep_desc->Clone(); - EXPECT_EQ(jsep_desc->type(), new_desc->type()); + EXPECT_EQ(jsep_desc->GetType(), new_desc->GetType()); EXPECT_EQ(jsep_desc->session_id(), new_desc->session_id()); EXPECT_EQ(jsep_desc->session_version(), new_desc->session_version()); } @@ -156,7 +156,7 @@ TEST_F(JsepSessionDescriptionTest, CloneWithCandidates) { ASSERT_TRUE(jsep_desc_->AddCandidate(&jice_v4_video)); ASSERT_TRUE(jsep_desc_->AddCandidate(&jice_v6_video)); auto new_desc = jsep_desc_->Clone(); - EXPECT_EQ(jsep_desc_->type(), new_desc->type()); + EXPECT_EQ(jsep_desc_->GetType(), new_desc->GetType()); ASSERT_EQ(jsep_desc_->number_of_mediasections(), new_desc->number_of_mediasections()); for (size_t i = 0; i < jsep_desc_->number_of_mediasections(); ++i) { diff --git a/third_party/libwebrtc/pc/test/integration_test_helpers.h b/third_party/libwebrtc/pc/test/integration_test_helpers.h @@ -692,7 +692,7 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, std::string sdp; EXPECT_TRUE(desc->ToString(&sdp)); RTC_LOG(LS_INFO) << debug_name_ - << ": SetRemoteDescription SDP: type=" << desc->type() + << ": SetRemoteDescription SDP: type=" << desc->GetType() << " contents=\n" << sdp; pc()->SetRemoteDescription(std::move(desc), observer); // desc.release()); @@ -778,7 +778,7 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, SdpType type = desc->GetType(); std::string sdp; EXPECT_TRUE(desc->ToString(&sdp)); - RTC_LOG(LS_INFO) << debug_name_ << ": local SDP type=" << desc->type() + RTC_LOG(LS_INFO) << debug_name_ << ": local SDP type=" << desc->GetType() << " contents=\n" << sdp; pc()->SetLocalDescription(observer.get(), desc.release()); diff --git a/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCSessionDescription+Private.h b/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCSessionDescription+Private.h @@ -37,6 +37,8 @@ NS_ASSUME_NONNULL_BEGIN + (RTCSdpType)typeForStdString:(const std::string &)string; ++ (RTCSdpType)typeForSdpType:(webrtc::SdpType)type; + @end NS_ASSUME_NONNULL_END diff --git a/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCSessionDescription.mm b/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCSessionDescription.mm @@ -70,7 +70,7 @@ NSParameterAssert(nativeDescription); std::string sdp; nativeDescription->ToString(&sdp); - RTCSdpType type = [[self class] typeForStdString:nativeDescription->type()]; + RTCSdpType type = [[self class] typeForSdpType:nativeDescription->GetType()]; return [self initWithType:type sdp:[NSString stringForStdString:sdp]]; } @@ -103,6 +103,21 @@ } } ++ (RTCSdpType)typeForSdpType:(webrtc::SdpType)type { + if (type == webrtc::SdpType::kOffer) { + return RTCSdpTypeOffer; + } else if (type == webrtc::SdpType::kPrAnswer) { + return RTCSdpTypePrAnswer; + } else if (type == webrtc::SdpType::kAnswer) { + return RTCSdpTypeAnswer; + } else if (type == webrtc::SdpType::kRollback) { + return RTCSdpTypeRollback; + } else { + RTC_DCHECK_NOTREACHED(); + return RTCSdpTypeOffer; + } +} + + (webrtc::SdpType)nativeTypeForType:(RTCSdpType)type { switch (type) { case RTCSdpTypeOffer: diff --git a/third_party/libwebrtc/sdk/objc/unittests/RTCSessionDescriptionTest.mm b/third_party/libwebrtc/sdk/objc/unittests/RTCSessionDescriptionTest.mm @@ -39,7 +39,7 @@ EXPECT_EQ(RTCSdpTypeAnswer, [RTC_OBJC_TYPE(RTCSessionDescription) - typeForStdString:nativeDescription->type()]); + typeForSdpType:nativeDescription->GetType()]); std::string sdp; nativeDescription->ToString(&sdp);