Skip to content

Commit

Permalink
Bug 1851693 - Vendor libwebrtc from ebf9a1faf8
Browse files Browse the repository at this point in the history
We already cherry-picked this when we vendored 43670de877.

Upstream commit: https://webrtc.googlesource.com/src/+/ebf9a1faf81f30f9fb6d1a9390545e562c62ec06
    [M116] Avoid touching channel after OnSctpDataChannelClosed

    (cherry picked from commit eec1810760ccbdf95c68ed0d2c2ae10a8575551a)

    Bug: chromium:1454086
    Change-Id: I39573b706c4031d091c45a182b13cb3b2dba6233
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309920
    Reviewed-by: Harald Alvestrand <[email protected]>
    Commit-Queue: Tomas Gunnarsson <[email protected]>
    Cr-Original-Commit-Position: refs/heads/main@{#40332}
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/310920
    Reviewed-by: Mirko Bonadei <[email protected]>
    Cr-Commit-Position: refs/branch-heads/5845@{#1}
    Cr-Branched-From: f80cf814353d11a9f22bef5ce5e8868f2c72f0d0-refs/heads/main@{#40319}
  • Loading branch information
Drekabi committed Sep 19, 2023
1 parent 80a81ea commit c96bb3f
Show file tree
Hide file tree
Showing 107 changed files with 10,189 additions and 10,235 deletions.
3 changes: 3 additions & 0 deletions third_party/libwebrtc/README.moz-ff-commit
Original file line number Diff line number Diff line change
Expand Up @@ -24639,3 +24639,6 @@ ff58aed678
# MOZ_LIBWEBRTC_SRC=/Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
f80cf81435
# MOZ_LIBWEBRTC_SRC=/Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
ebf9a1faf8
2 changes: 2 additions & 0 deletions third_party/libwebrtc/README.mozilla
Original file line number Diff line number Diff line change
Expand Up @@ -16448,3 +16448,5 @@ libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc co
libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-09-19T20:35:06.982164.
# ./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 2023-09-19T20:37:00.314247.
# ./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 2023-09-19T20:38:15.033382.
107 changes: 67 additions & 40 deletions third_party/libwebrtc/moz-patch-stack/0001.patch
Original file line number Diff line number Diff line change
@@ -1,50 +1,77 @@
From: Tommi <[email protected]>
Date: Thu, 22 Jun 2023 10:13:52 +0200
Subject: (cherry-pick-branch-heads/5790) [M115] Avoid touching channel after
OnSctpDataChannelClosed
From: Philipp Hancke <[email protected]>
Date: Fri, 14 Jul 2023 10:47:11 +0200
Subject: (cherry-pick-branch-heads/5790) [M115] Bail out early if the RTP send
module for a SSRC was not found

(cherry picked from commit eec1810760ccbdf95c68ed0d2c2ae10a8575551a)
since it might have been deregistered previously.

Bug: chromium:1454086
Change-Id: I39573b706c4031d091c45a182b13cb3b2dba6233
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/309920
BUG=chromium:1454860,chromium:1459124

(cherry picked from commit c0ed83eac258032a2416b7e4200bd074a6455f4b)

Change-Id: I70ba43265361d040e568f83b6400ff8f3c2a8e98
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311800
Reviewed-by: Harald Alvestrand <[email protected]>
Commit-Queue: Tomas Gunnarsson <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#40332}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/310921
Reviewed-by: Mirko Bonadei <[email protected]>
Cr-Commit-Position: refs/branch-heads/5790@{#6}
Commit-Queue: Philipp Hancke <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#40431}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312121
Cr-Commit-Position: refs/branch-heads/5790@{#7}
Cr-Branched-From: 2eacbbc03a4a41ea658661225eb1c8fc07884c33-refs/heads/main@{#40122}
---
pc/data_channel_controller.cc | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
modules/pacing/packet_router.cc | 5 ++++-
modules/pacing/packet_router_unittest.cc | 16 +++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/pc/data_channel_controller.cc b/pc/data_channel_controller.cc
index 7fea6c5e55..93599fdba9 100644
--- a/pc/data_channel_controller.cc
+++ b/pc/data_channel_controller.cc
@@ -70,6 +70,11 @@ void DataChannelController::OnChannelStateChanged(
SctpDataChannel* channel,
DataChannelInterface::DataState state) {
RTC_DCHECK_RUN_ON(network_thread());
+
+ // Stash away the internal id here in case `OnSctpDataChannelClosed` ends up
+ // releasing the last reference to the channel.
+ const int channel_id = channel->internal_id();
+
if (state == DataChannelInterface::DataState::kClosed)
OnSctpDataChannelClosed(channel);
diff --git a/modules/pacing/packet_router.cc b/modules/pacing/packet_router.cc
index 135b618bfa..ba133f3d1f 100644
--- a/modules/pacing/packet_router.cc
+++ b/modules/pacing/packet_router.cc
@@ -88,7 +88,10 @@ void PacketRouter::AddSendRtpModuleToMap(RtpRtcpInterface* rtp_module,
void PacketRouter::RemoveSendRtpModuleFromMap(uint32_t ssrc) {
RTC_DCHECK_RUN_ON(&thread_checker_);
auto it = send_modules_map_.find(ssrc);
- RTC_DCHECK(it != send_modules_map_.end());
+ if (it == send_modules_map_.end()) {
+ RTC_LOG(LS_ERROR) << "No send module found for ssrc " << ssrc;
+ return;
+ }
send_modules_list_.remove(it->second);
RTC_CHECK(modules_used_in_current_batch_.empty());
send_modules_map_.erase(it);
diff --git a/modules/pacing/packet_router_unittest.cc b/modules/pacing/packet_router_unittest.cc
index 7604de6fba..af8534316c 100644
--- a/modules/pacing/packet_router_unittest.cc
+++ b/modules/pacing/packet_router_unittest.cc
@@ -541,18 +541,24 @@ TEST_F(PacketRouterDeathTest, DoubleRegistrationOfReceiveModuleDisallowed) {
packet_router_.RemoveReceiveRtpModule(&module);
}

-TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedSendModuleDisallowed) {
+TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
NiceMock<MockRtpRtcpInterface> module;

- EXPECT_DEATH(packet_router_.RemoveSendRtpModule(&module), "");
+ EXPECT_DEATH(packet_router_.RemoveReceiveRtpModule(&module), "");
}
+#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)

-TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
+TEST_F(PacketRouterTest, RemovalOfNeverAddedSendModuleIgnored) {
NiceMock<MockRtpRtcpInterface> module;
+ packet_router_.RemoveSendRtpModule(&module);
+}

- EXPECT_DEATH(packet_router_.RemoveReceiveRtpModule(&module), "");
+TEST_F(PacketRouterTest, DuplicateRemovalOfSendModuleIgnored) {
+ NiceMock<MockRtpRtcpInterface> module;
+ packet_router_.AddSendRtpModule(&module, false);
+ packet_router_.RemoveSendRtpModule(&module);
+ packet_router_.RemoveSendRtpModule(&module);
}
-#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)

@@ -77,8 +82,7 @@ void DataChannelController::OnChannelStateChanged(
? DataChannelUsage::kHaveBeenUsed
: DataChannelUsage::kInUse;
signaling_thread()->PostTask(SafeTask(
- signaling_safety_.flag(), [this, channel_id = channel->internal_id(),
- state = state, channel_usage] {
+ signaling_safety_.flag(), [this, channel_id, state, channel_usage] {
RTC_DCHECK_RUN_ON(signaling_thread());
channel_usage_ = channel_usage;
pc_->OnSctpDataChannelStateChanged(channel_id, state);
TEST(PacketRouterRembTest, ChangeSendRtpModuleChangeRembSender) {
rtc::ScopedFakeClock clock;
--
2.37.3

98 changes: 34 additions & 64 deletions third_party/libwebrtc/moz-patch-stack/0002.patch
Original file line number Diff line number Diff line change
@@ -1,77 +1,47 @@
From: Philipp Hancke <[email protected]>
Date: Fri, 14 Jul 2023 10:47:11 +0200
Subject: (cherry-pick-branch-heads/5790) [M115] Bail out early if the RTP send
module for a SSRC was not found
From: Tommi <[email protected]>
Date: Mon, 26 Jun 2023 21:11:35 +0200
Subject: (cherry-pick-branch-heads/5790) [M115] Revert mid check in
SdpOfferAnswerHandler::CreateDataChannel.

since it might have been deregistered previously.
This check was added here:
https://webrtc-review.googlesource.com/c/src/+/300544

BUG=chromium:1454860,chromium:1459124
When createOffer is used before createAnswer, this check would cause
SetupDataChannelTransport_n to not be called for the remote channel.

(cherry picked from commit c0ed83eac258032a2416b7e4200bd074a6455f4b)
(cherry picked from commit 299cdc9057fb8925f1692ac8c7573f51b7872df6)

Change-Id: I70ba43265361d040e568f83b6400ff8f3c2a8e98
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311800
Bug: webrtc:15258
Change-Id: Ifdab35d1b0260ff03fef4beff13acf8090d59d8f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/310460
Reviewed-by: Harald Alvestrand <[email protected]>
Commit-Queue: Philipp Hancke <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#40431}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312121
Cr-Commit-Position: refs/branch-heads/5790@{#7}
Commit-Queue: Tomas Gunnarsson <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#40357}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/313620
Reviewed-by: Mirko Bonadei <[email protected]>
Cr-Commit-Position: refs/branch-heads/5790@{#8}
Cr-Branched-From: 2eacbbc03a4a41ea658661225eb1c8fc07884c33-refs/heads/main@{#40122}
---
modules/pacing/packet_router.cc | 5 ++++-
modules/pacing/packet_router_unittest.cc | 16 +++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
pc/sdp_offer_answer.cc | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/modules/pacing/packet_router.cc b/modules/pacing/packet_router.cc
index 135b618bfa..ba133f3d1f 100644
--- a/modules/pacing/packet_router.cc
+++ b/modules/pacing/packet_router.cc
@@ -88,7 +88,10 @@ void PacketRouter::AddSendRtpModuleToMap(RtpRtcpInterface* rtp_module,
void PacketRouter::RemoveSendRtpModuleFromMap(uint32_t ssrc) {
RTC_DCHECK_RUN_ON(&thread_checker_);
auto it = send_modules_map_.find(ssrc);
- RTC_DCHECK(it != send_modules_map_.end());
+ if (it == send_modules_map_.end()) {
+ RTC_LOG(LS_ERROR) << "No send module found for ssrc " << ssrc;
+ return;
+ }
send_modules_list_.remove(it->second);
RTC_CHECK(modules_used_in_current_batch_.empty());
send_modules_map_.erase(it);
diff --git a/modules/pacing/packet_router_unittest.cc b/modules/pacing/packet_router_unittest.cc
index 7604de6fba..af8534316c 100644
--- a/modules/pacing/packet_router_unittest.cc
+++ b/modules/pacing/packet_router_unittest.cc
@@ -541,18 +541,24 @@ TEST_F(PacketRouterDeathTest, DoubleRegistrationOfReceiveModuleDisallowed) {
packet_router_.RemoveReceiveRtpModule(&module);
}
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc
index 6596d82167..4874444eae 100644
--- a/pc/sdp_offer_answer.cc
+++ b/pc/sdp_offer_answer.cc
@@ -5145,11 +5145,7 @@ RTCError SdpOfferAnswerHandler::CreateChannels(const SessionDescription& desc) {

-TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedSendModuleDisallowed) {
+TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
NiceMock<MockRtpRtcpInterface> module;
bool SdpOfferAnswerHandler::CreateDataChannel(const std::string& mid) {
RTC_DCHECK_RUN_ON(signaling_thread());
- if (pc_->sctp_mid().has_value()) {
- RTC_DCHECK_EQ(mid, *pc_->sctp_mid());
- return true; // data channel already created.
- }
-
+ RTC_DCHECK(!pc_->sctp_mid().has_value() || mid == pc_->sctp_mid().value());
RTC_LOG(LS_INFO) << "Creating data channel, mid=" << mid;

- EXPECT_DEATH(packet_router_.RemoveSendRtpModule(&module), "");
+ EXPECT_DEATH(packet_router_.RemoveReceiveRtpModule(&module), "");
}
+#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)

-TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
+TEST_F(PacketRouterTest, RemovalOfNeverAddedSendModuleIgnored) {
NiceMock<MockRtpRtcpInterface> module;
+ packet_router_.RemoveSendRtpModule(&module);
+}

- EXPECT_DEATH(packet_router_.RemoveReceiveRtpModule(&module), "");
+TEST_F(PacketRouterTest, DuplicateRemovalOfSendModuleIgnored) {
+ NiceMock<MockRtpRtcpInterface> module;
+ packet_router_.AddSendRtpModule(&module, false);
+ packet_router_.RemoveSendRtpModule(&module);
+ packet_router_.RemoveSendRtpModule(&module);
}
-#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)

TEST(PacketRouterRembTest, ChangeSendRtpModuleChangeRembSender) {
rtc::ScopedFakeClock clock;
absl::optional<std::string> transport_name =
--
2.37.3

Loading

0 comments on commit c96bb3f

Please sign in to comment.