From 8695282243a5bf232ad1c21c9799620a955b32ce Mon Sep 17 00:00:00 2001 From: Tommi Date: Mon, 29 Nov 2021 10:26:40 +0100 Subject: [PATCH] Remove unnecessary copy of suspended_ssrcs. Also removing pass-by-value in ctor. Bug: none Change-Id: I09e36fd955c8f306c4a347d8befc6eea38384cb9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/239183 Auto-Submit: Tommi Reviewed-by: Niels Moller Commit-Queue: Tommi Cr-Commit-Position: refs/heads/main@{#35427} --- call/rtp_transport_controller_send.cc | 2 +- call/rtp_transport_controller_send.h | 2 +- call/rtp_transport_controller_send_interface.h | 2 +- call/rtp_video_sender.cc | 18 +++++++++--------- call/rtp_video_sender.h | 6 ++---- call/test/mock_rtp_transport_controller_send.h | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc index 8825df2f7b..11c299c19b 100644 --- a/call/rtp_transport_controller_send.cc +++ b/call/rtp_transport_controller_send.cc @@ -156,7 +156,7 @@ RtpTransportControllerSend::~RtpTransportControllerSend() { } RtpVideoSenderInterface* RtpTransportControllerSend::CreateRtpVideoSender( - std::map suspended_ssrcs, + const std::map& suspended_ssrcs, const std::map& states, const RtpConfig& rtp_config, int rtcp_report_interval_ms, diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h index ac4213d568..62af78ceb8 100644 --- a/call/rtp_transport_controller_send.h +++ b/call/rtp_transport_controller_send.h @@ -65,7 +65,7 @@ class RtpTransportControllerSend final // TODO(tommi): Change to std::unique_ptr<>. RtpVideoSenderInterface* CreateRtpVideoSender( - std::map suspended_ssrcs, + const std::map& suspended_ssrcs, const std::map& states, // move states into RtpTransportControllerSend const RtpConfig& rtp_config, diff --git a/call/rtp_transport_controller_send_interface.h b/call/rtp_transport_controller_send_interface.h index 2aa6d739da..f68c4bf3dd 100644 --- a/call/rtp_transport_controller_send_interface.h +++ b/call/rtp_transport_controller_send_interface.h @@ -96,7 +96,7 @@ class RtpTransportControllerSendInterface { virtual PacketRouter* packet_router() = 0; virtual RtpVideoSenderInterface* CreateRtpVideoSender( - std::map suspended_ssrcs, + const std::map& suspended_ssrcs, // TODO(holmer): Move states into RtpTransportControllerSend. const std::map& states, const RtpConfig& rtp_config, diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc index c83d697cf5..b953705459 100644 --- a/call/rtp_video_sender.cc +++ b/call/rtp_video_sender.cc @@ -347,7 +347,7 @@ bool IsFirstFrameOfACodedVideoSequence( RtpVideoSender::RtpVideoSender( Clock* clock, - std::map suspended_ssrcs, + const std::map& suspended_ssrcs, const std::map& states, const RtpConfig& rtp_config, int rtcp_report_interval_ms, @@ -371,7 +371,6 @@ RtpVideoSender::RtpVideoSender( field_trials_.Lookup("WebRTC-GenericCodecDependencyDescriptor"), "Enabled")), active_(false), - suspended_ssrcs_(std::move(suspended_ssrcs)), fec_controller_(std::move(fec_controller)), fec_allowed_(true), rtp_streams_(CreateRtpStreamSenders(clock, @@ -381,7 +380,7 @@ RtpVideoSender::RtpVideoSender( send_transport, transport->GetBandwidthObserver(), transport, - suspended_ssrcs_, + suspended_ssrcs, event_log, retransmission_limiter, frame_encryptor, @@ -421,7 +420,7 @@ RtpVideoSender::RtpVideoSender( } } - ConfigureSsrcs(); + ConfigureSsrcs(suspended_ssrcs); ConfigureRids(); if (!rtp_config_.mid.empty()) { @@ -683,7 +682,8 @@ void RtpVideoSender::DeliverRtcp(const uint8_t* packet, size_t length) { stream.rtp_rtcp->IncomingRtcpPacket(packet, length); } -void RtpVideoSender::ConfigureSsrcs() { +void RtpVideoSender::ConfigureSsrcs( + const std::map& suspended_ssrcs) { // Configure regular SSRCs. RTC_CHECK(ssrc_to_rtp_module_.empty()); for (size_t i = 0; i < rtp_config_.ssrcs.size(); ++i) { @@ -691,8 +691,8 @@ void RtpVideoSender::ConfigureSsrcs() { RtpRtcpInterface* const rtp_rtcp = rtp_streams_[i].rtp_rtcp.get(); // Restore RTP state if previous existed. - auto it = suspended_ssrcs_.find(ssrc); - if (it != suspended_ssrcs_.end()) + auto it = suspended_ssrcs.find(ssrc); + if (it != suspended_ssrcs.end()) rtp_rtcp->SetRtpState(it->second); ssrc_to_rtp_module_[ssrc] = rtp_rtcp; @@ -706,8 +706,8 @@ void RtpVideoSender::ConfigureSsrcs() { for (size_t i = 0; i < rtp_config_.rtx.ssrcs.size(); ++i) { uint32_t ssrc = rtp_config_.rtx.ssrcs[i]; RtpRtcpInterface* const rtp_rtcp = rtp_streams_[i].rtp_rtcp.get(); - auto it = suspended_ssrcs_.find(ssrc); - if (it != suspended_ssrcs_.end()) + auto it = suspended_ssrcs.find(ssrc); + if (it != suspended_ssrcs.end()) rtp_rtcp->SetRtxState(it->second); } diff --git a/call/rtp_video_sender.h b/call/rtp_video_sender.h index 704ed0e1a6..7e5de98763 100644 --- a/call/rtp_video_sender.h +++ b/call/rtp_video_sender.h @@ -74,7 +74,7 @@ class RtpVideoSender : public RtpVideoSenderInterface, // Rtp modules are assumed to be sorted in simulcast index order. RtpVideoSender( Clock* clock, - std::map suspended_ssrcs, + const std::map& suspended_ssrcs, const std::map& states, const RtpConfig& rtp_config, int rtcp_report_interval_ms, @@ -155,7 +155,7 @@ class RtpVideoSender : public RtpVideoSenderInterface, RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void UpdateModuleSendingState() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void ConfigureProtection(); - void ConfigureSsrcs(); + void ConfigureSsrcs(const std::map& suspended_ssrcs); void ConfigureRids(); bool NackEnabled() const; uint32_t GetPacketizationOverheadRate() const; @@ -175,8 +175,6 @@ class RtpVideoSender : public RtpVideoSenderInterface, mutable Mutex mutex_; bool active_ RTC_GUARDED_BY(mutex_); - std::map suspended_ssrcs_; - const std::unique_ptr fec_controller_; bool fec_allowed_ RTC_GUARDED_BY(mutex_); diff --git a/call/test/mock_rtp_transport_controller_send.h b/call/test/mock_rtp_transport_controller_send.h index b468aa6cb2..8d637a3b5c 100644 --- a/call/test/mock_rtp_transport_controller_send.h +++ b/call/test/mock_rtp_transport_controller_send.h @@ -34,7 +34,7 @@ class MockRtpTransportControllerSend public: MOCK_METHOD(RtpVideoSenderInterface*, CreateRtpVideoSender, - ((std::map), + ((const std::map&), (const std::map&), const RtpConfig&, int rtcp_report_interval_ms,