From 5f38949c54563e8c021370d9b030109b6e6fa2be Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Wed, 17 May 2023 12:23:53 +0200 Subject: [PATCH] Allow single-mline offers without BUNDLE group when using max-bundle since BUNDLE is not meaningful for those cases. This matches Firefox behavior. BUG=chromium:1444615 Change-Id: Id841b7e30a1c920efd977caebc71ab25d084577a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305640 Reviewed-by: Harald Alvestrand Reviewed-by: Florent Castelli Commit-Queue: Philipp Hancke Cr-Commit-Position: refs/heads/main@{#40151} --- pc/jsep_transport_controller.cc | 3 ++- pc/jsep_transport_controller_unittest.cc | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc index e36ecafeed..667668053d 100644 --- a/pc/jsep_transport_controller.cc +++ b/pc/jsep_transport_controller.cc @@ -813,7 +813,8 @@ RTCError JsepTransportController::ValidateAndMaybeUpdateBundleGroups( if (config_.bundle_policy == PeerConnectionInterface::kBundlePolicyMaxBundle && - !description->HasGroup(cricket::GROUP_TYPE_BUNDLE)) { + !description->HasGroup(cricket::GROUP_TYPE_BUNDLE) && + description->contents().size() > 1) { return RTCError(RTCErrorType::INVALID_PARAMETER, "max-bundle is used but no bundle group found."); } diff --git a/pc/jsep_transport_controller_unittest.cc b/pc/jsep_transport_controller_unittest.cc index 8aecf63c5d..faa8842e35 100644 --- a/pc/jsep_transport_controller_unittest.cc +++ b/pc/jsep_transport_controller_unittest.cc @@ -2727,4 +2727,20 @@ TEST_F(JsepTransportControllerTest, BundleOnlySectionDoesNotNeedRtcpMux) { .ok()); } +// Test that with max-bundle a single unbundled m-line is accepted. +TEST_F(JsepTransportControllerTest, + MaxBundleDoesNotRequireBundleForFirstMline) { + auto config = JsepTransportController::Config(); + config.bundle_policy = PeerConnectionInterface::kBundlePolicyMaxBundle; + CreateJsepTransportController(std::move(config)); + + auto offer = std::make_unique(); + AddAudioSection(offer.get(), kAudioMid1, kIceUfrag1, kIcePwd1, + cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_ACTPASS, + nullptr); + EXPECT_TRUE( + transport_controller_->SetRemoteDescription(SdpType::kOffer, offer.get()) + .ok()); +} + } // namespace webrtc