Skip to content

Commit

Permalink
Bail out early if the RTP send module for a SSRC was not found
Browse files Browse the repository at this point in the history
since it might have been deregistered previously.

BUG=chromium:1454860,chromium:1459124

Change-Id: I70ba43265361d040e568f83b6400ff8f3c2a8e98
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/311800
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40431}
  • Loading branch information
fippo authored and WebRTC LUCI CQ committed Jul 14, 2023
1 parent 94abc09 commit c0ed83e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion modules/pacing/packet_router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 11 additions & 5 deletions modules/pacing/packet_router_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)

TEST(PacketRouterRembTest, ChangeSendRtpModuleChangeRembSender) {
rtc::ScopedFakeClock clock;
Expand Down

0 comments on commit c0ed83e

Please sign in to comment.