[M116] Bail out early if the RTP send module for a SSRC was not found

since it might have been deregistered previously.

BUG=chromium:1454860,chromium:1459124

(cherry picked from commit c0ed83eac2)

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-Original-Commit-Position: refs/heads/main@{#40431}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312120
Cr-Commit-Position: refs/branch-heads/5845@{#6}
Cr-Branched-From: f80cf814353d11a9f22bef5ce5e8868f2c72f0d0-refs/heads/main@{#40319}
This commit is contained in:
Philipp Hancke 2023-07-14 10:47:11 +02:00 committed by WebRTC LUCI CQ
parent 626d408ba5
commit 44bc8e96ed
2 changed files with 16 additions and 7 deletions

View file

@ -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);

View file

@ -541,12 +541,6 @@ TEST_F(PacketRouterDeathTest, DoubleRegistrationOfReceiveModuleDisallowed) {
packet_router_.RemoveReceiveRtpModule(&module);
}
TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedSendModuleDisallowed) {
NiceMock<MockRtpRtcpInterface> module;
EXPECT_DEATH(packet_router_.RemoveSendRtpModule(&module), "");
}
TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
NiceMock<MockRtpRtcpInterface> module;
@ -554,6 +548,18 @@ TEST_F(PacketRouterDeathTest, RemovalOfNeverAddedReceiveModuleDisallowed) {
}
#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(PacketRouterTest, RemovalOfNeverAddedSendModuleIgnored) {
NiceMock<MockRtpRtcpInterface> module;
packet_router_.RemoveSendRtpModule(&module);
}
TEST_F(PacketRouterTest, DuplicateRemovalOfSendModuleIgnored) {
NiceMock<MockRtpRtcpInterface> module;
packet_router_.AddSendRtpModule(&module, false);
packet_router_.RemoveSendRtpModule(&module);
packet_router_.RemoveSendRtpModule(&module);
}
TEST(PacketRouterRembTest, ChangeSendRtpModuleChangeRembSender) {
rtc::ScopedFakeClock clock;
NiceMock<MockRtpRtcpInterface> rtp_send;