Removing redundant argument for SSRCs from ctor of RtpVideoSender.

SSRCs are specified twice in calls to the RtpVideoSender constructor.
Once in the first argument of ssrcs, and then again in the RtpConfig
ssrcs variable. Resolving to reference the variable in the RtpConfig.

Bug: None
TBR: stefan@webrtc.org
Change-Id: I53528140166a53f3558f950d5662b7d3d6b8c822
Reviewed-on: https://webrtc-review.googlesource.com/c/114910
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26094}
This commit is contained in:
Amit Hilbuch 2018-12-18 13:01:47 -08:00 committed by Commit Bot
parent 06e88361c9
commit 0fc2843c10
9 changed files with 11 additions and 23 deletions

View File

@ -152,7 +152,6 @@ RtpTransportControllerSend::~RtpTransportControllerSend() {
}
RtpVideoSenderInterface* RtpTransportControllerSend::CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
const RtpConfig& rtp_config,
@ -163,7 +162,7 @@ RtpVideoSenderInterface* RtpTransportControllerSend::CreateRtpVideoSender(
std::unique_ptr<FecController> fec_controller,
const RtpSenderFrameEncryptionConfig& frame_encryption_config) {
video_rtp_senders_.push_back(absl::make_unique<RtpVideoSender>(
ssrcs, suspended_ssrcs, states, rtp_config, rtcp_report_interval_ms,
suspended_ssrcs, states, rtp_config, rtcp_report_interval_ms,
send_transport, observers,
// TODO(holmer): Remove this circular dependency by injecting
// the parts of RtpTransportControllerSendInterface that are really used.

View File

@ -52,7 +52,6 @@ class RtpTransportControllerSend final
~RtpTransportControllerSend() override;
RtpVideoSenderInterface* CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>&
states, // move states into RtpTransportControllerSend

View File

@ -100,7 +100,6 @@ class RtpTransportControllerSendInterface {
virtual PacketRouter* packet_router() = 0;
virtual RtpVideoSenderInterface* CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
// TODO(holmer): Move states into RtpTransportControllerSend.
const std::map<uint32_t, RtpPayloadState>& states,

View File

@ -39,7 +39,6 @@ static const int kSendSideSeqNumSetMaxSize = 5500;
static const size_t kPathMTU = 1500;
std::vector<std::unique_ptr<RtpRtcp>> CreateRtpRtcpModules(
const std::vector<uint32_t>& ssrcs,
const RtpConfig& rtp_config,
int rtcp_report_interval_ms,
Transport* send_transport,
@ -59,7 +58,7 @@ std::vector<std::unique_ptr<RtpRtcp>> CreateRtpRtcpModules(
RtpKeepAliveConfig keepalive_config,
FrameEncryptorInterface* frame_encryptor,
const CryptoOptions& crypto_options) {
RTC_DCHECK_GT(ssrcs.size(), 0);
RTC_DCHECK_GT(rtp_config.ssrcs.size(), 0);
RtpRtcp::Configuration configuration;
configuration.audio = false;
@ -91,7 +90,7 @@ std::vector<std::unique_ptr<RtpRtcp>> CreateRtpRtcpModules(
std::vector<std::unique_ptr<RtpRtcp>> modules;
const std::vector<uint32_t>& flexfec_protected_ssrcs =
rtp_config.flexfec.protected_media_ssrcs;
for (uint32_t ssrc : ssrcs) {
for (uint32_t ssrc : rtp_config.ssrcs) {
bool enable_flexfec = flexfec_sender != nullptr &&
std::find(flexfec_protected_ssrcs.begin(),
flexfec_protected_ssrcs.end(),
@ -179,7 +178,6 @@ int CalculatePacketRate(uint32_t bitrate_bps, size_t packet_size_bytes) {
} // namespace
RtpVideoSender::RtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
const RtpConfig& rtp_config,
@ -199,8 +197,7 @@ RtpVideoSender::RtpVideoSender(
suspended_ssrcs_(std::move(suspended_ssrcs)),
flexfec_sender_(MaybeCreateFlexfecSender(rtp_config, suspended_ssrcs_)),
fec_controller_(std::move(fec_controller)),
rtp_modules_(CreateRtpRtcpModules(ssrcs,
rtp_config,
rtp_modules_(CreateRtpRtcpModules(rtp_config,
rtcp_report_interval_ms,
send_transport,
observers.intra_frame_callback,
@ -224,13 +221,10 @@ RtpVideoSender::RtpVideoSender(
transport_overhead_bytes_per_packet_(0),
overhead_bytes_per_packet_(0),
encoder_target_rate_bps_(0) {
RTC_DCHECK_EQ(ssrcs.size(), rtp_modules_.size());
// The same argument for SSRCs is given to this method twice.
// The SSRCs are also accessed in this method through both variables.
RTC_DCHECK(ssrcs == rtp_config.ssrcs);
RTC_DCHECK_EQ(rtp_config.ssrcs.size(), rtp_modules_.size());
module_process_thread_checker_.DetachFromThread();
// SSRCs are assumed to be sorted in the same order as |rtp_modules|.
for (uint32_t ssrc : ssrcs) {
for (uint32_t ssrc : rtp_config.ssrcs) {
// Restore state if it previously existed.
const RtpPayloadState* state = nullptr;
auto it = states.find(ssrc);

View File

@ -49,7 +49,6 @@ class RtpVideoSender : public RtpVideoSenderInterface,
public:
// Rtp modules are assumed to be sorted in simulcast index order.
RtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
const RtpConfig& rtp_config,

View File

@ -92,8 +92,8 @@ class RtpVideoSenderTestFixture {
config_.rtp.payload_type = payload_type;
std::map<uint32_t, RtpState> suspended_ssrcs;
router_ = absl::make_unique<RtpVideoSender>(
config_.rtp.ssrcs, suspended_ssrcs, suspended_payload_states,
config_.rtp, config_.rtcp_report_interval_ms, &transport_,
suspended_ssrcs, suspended_payload_states, config_.rtp,
config_.rtcp_report_interval_ms, &transport_,
CreateObservers(&call_stats_, &encoder_feedback_, &stats_proxy_,
&stats_proxy_, &stats_proxy_, &stats_proxy_,
&stats_proxy_, &stats_proxy_, &send_delay_stats_),

View File

@ -32,10 +32,9 @@ namespace webrtc {
class MockRtpTransportControllerSend
: public RtpTransportControllerSendInterface {
public:
MOCK_METHOD10(
MOCK_METHOD9(
CreateRtpVideoSender,
RtpVideoSenderInterface*(const std::vector<uint32_t>&,
std::map<uint32_t, RtpState>,
RtpVideoSenderInterface*(std::map<uint32_t, RtpState>,
const std::map<uint32_t, RtpPayloadState>&,
const RtpConfig&,
int rtcp_report_interval_ms,

View File

@ -268,7 +268,6 @@ VideoSendStreamImpl::VideoSendStreamImpl(
video_stream_encoder),
bandwidth_observer_(transport->GetBandwidthObserver()),
rtp_video_sender_(transport_->CreateRtpVideoSender(
config_->rtp.ssrcs,
suspended_ssrcs,
suspended_payload_states,
config_->rtp,

View File

@ -99,7 +99,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
EXPECT_CALL(transport_controller_, packet_router())
.WillRepeatedly(Return(&packet_router_));
EXPECT_CALL(transport_controller_,
CreateRtpVideoSender(_, _, _, _, _, _, _, _, _, _))
CreateRtpVideoSender(_, _, _, _, _, _, _, _, _))
.WillRepeatedly(Return(&rtp_video_sender_));
EXPECT_CALL(rtp_video_sender_, SetActive(_))
.WillRepeatedly(testing::Invoke(