Rename PayloadRouter to RtpVideoSender.

Bug: webrtc:9517
Change-Id: I18397a28067dbe5029fc80fe2eef360869abb339
Reviewed-on: https://webrtc-review.googlesource.com/89380
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24039}
This commit is contained in:
Stefan Holmer
2018-07-19 10:34:38 +02:00
committed by Commit Bot
parent 692409f8e7
commit 9416ef8c4f
16 changed files with 123 additions and 134 deletions

View File

@ -100,13 +100,13 @@ rtc_source_set("rtp_receiver") {
rtc_source_set("rtp_sender") {
sources = [
"payload_router.cc",
"payload_router.h",
"rtp_payload_params.cc",
"rtp_payload_params.h",
"rtp_transport_controller_send.cc",
"rtp_transport_controller_send.h",
"video_rtp_sender_interface.h",
"rtp_video_sender.cc",
"rtp_video_sender.h",
"rtp_video_sender_interface.h",
]
deps = [
":bitrate_configurator",
@ -284,13 +284,13 @@ if (rtc_include_tests) {
"bitrate_estimator_tests.cc",
"call_unittest.cc",
"flexfec_receive_stream_unittest.cc",
"payload_router_unittest.cc",
"receive_time_calculator_unittest.cc",
"rtcp_demuxer_unittest.cc",
"rtp_bitrate_configurator_unittest.cc",
"rtp_demuxer_unittest.cc",
"rtp_payload_params_unittest.cc",
"rtp_rtcp_demuxer_helper_unittest.cc",
"rtp_video_sender_unittest.cc",
"rtx_receive_stream_unittest.cc",
]
deps = [

View File

@ -10,7 +10,7 @@
#include <memory>
#include "call/payload_router.h"
#include "call/rtp_payload_params.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "test/gtest.h"

View File

@ -84,7 +84,7 @@ RtpTransportControllerSend::~RtpTransportControllerSend() {
process_thread_->DeRegisterModule(&pacer_);
}
VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
RtpVideoSenderInterface* RtpTransportControllerSend::CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
@ -93,7 +93,7 @@ VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
Transport* send_transport,
const RtpSenderObservers& observers,
RtcEventLog* event_log) {
video_rtp_senders_.push_back(absl::make_unique<PayloadRouter>(
video_rtp_senders_.push_back(absl::make_unique<RtpVideoSender>(
ssrcs, suspended_ssrcs, states, rtp_config, rtcp_config, send_transport,
observers,
// TODO(holmer): Remove this circular dependency by injecting
@ -102,9 +102,9 @@ VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
return video_rtp_senders_.back().get();
}
void RtpTransportControllerSend::DestroyVideoRtpSender(
VideoRtpSenderInterface* rtp_video_sender) {
std::vector<std::unique_ptr<VideoRtpSenderInterface>>::iterator it =
void RtpTransportControllerSend::DestroyRtpVideoSender(
RtpVideoSenderInterface* rtp_video_sender) {
std::vector<std::unique_ptr<RtpVideoSenderInterface>>::iterator it =
video_rtp_senders_.end();
for (it = video_rtp_senders_.begin(); it != video_rtp_senders_.end(); ++it) {
if (it->get() == rtp_video_sender) {

View File

@ -17,9 +17,9 @@
#include <vector>
#include "api/transport/network_control.h"
#include "call/payload_router.h"
#include "call/rtp_bitrate_configurator.h"
#include "call/rtp_transport_controller_send_interface.h"
#include "call/rtp_video_sender.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
#include "modules/pacing/packet_router.h"
@ -46,7 +46,7 @@ class RtpTransportControllerSend final
const BitrateConstraints& bitrate_config);
~RtpTransportControllerSend() override;
VideoRtpSenderInterface* CreateVideoRtpSender(
RtpVideoSenderInterface* CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>&
@ -56,8 +56,8 @@ class RtpTransportControllerSend final
Transport* send_transport,
const RtpSenderObservers& observers,
RtcEventLog* event_log) override;
void DestroyVideoRtpSender(
VideoRtpSenderInterface* rtp_video_sender) override;
void DestroyRtpVideoSender(
RtpVideoSenderInterface* rtp_video_sender) override;
// Implements NetworkChangedObserver interface.
void OnNetworkChanged(uint32_t bitrate_bps,
@ -105,7 +105,7 @@ class RtpTransportControllerSend final
private:
const Clock* const clock_;
PacketRouter packet_router_;
std::vector<std::unique_ptr<VideoRtpSenderInterface>> video_rtp_senders_;
std::vector<std::unique_ptr<RtpVideoSenderInterface>> video_rtp_senders_;
PacedSender pacer_;
RtpKeepAliveConfig keepalive_;
RtpBitrateConfigurator bitrate_configurator_;

View File

@ -39,7 +39,7 @@ class Module;
class PacedSender;
class PacketFeedbackObserver;
class PacketRouter;
class VideoRtpSenderInterface;
class RtpVideoSenderInterface;
class RateLimiter;
class RtcpBandwidthObserver;
class RtpPacketSender;
@ -90,7 +90,7 @@ class RtpTransportControllerSendInterface {
virtual rtc::TaskQueue* GetWorkerQueue() = 0;
virtual PacketRouter* packet_router() = 0;
virtual VideoRtpSenderInterface* CreateVideoRtpSender(
virtual RtpVideoSenderInterface* CreateRtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
// TODO(holmer): Move states into RtpTransportControllerSend.
@ -100,8 +100,8 @@ class RtpTransportControllerSendInterface {
Transport* send_transport,
const RtpSenderObservers& observers,
RtcEventLog* event_log) = 0;
virtual void DestroyVideoRtpSender(
VideoRtpSenderInterface* rtp_video_sender) = 0;
virtual void DestroyRtpVideoSender(
RtpVideoSenderInterface* rtp_video_sender) = 0;
virtual TransportFeedbackObserver* transport_feedback_observer() = 0;

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "call/payload_router.h"
#include "call/rtp_video_sender.h"
#include <memory>
#include <string>
@ -161,16 +161,17 @@ std::unique_ptr<FlexfecSender> MaybeCreateFlexfecSender(
}
} // namespace
PayloadRouter::PayloadRouter(const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
const RtpConfig& rtp_config,
const RtcpConfig& rtcp_config,
Transport* send_transport,
const RtpSenderObservers& observers,
RtpTransportControllerSendInterface* transport,
RtcEventLog* event_log,
RateLimiter* retransmission_limiter)
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,
const RtcpConfig& rtcp_config,
Transport* send_transport,
const RtpSenderObservers& observers,
RtpTransportControllerSendInterface* transport,
RtcEventLog* event_log,
RateLimiter* retransmission_limiter)
: active_(false),
module_process_thread_(nullptr),
suspended_ssrcs_(std::move(suspended_ssrcs)),
@ -254,13 +255,13 @@ PayloadRouter::PayloadRouter(const std::vector<uint32_t>& ssrcs,
}
}
PayloadRouter::~PayloadRouter() {
RtpVideoSender::~RtpVideoSender() {
for (auto& rtp_rtcp : rtp_modules_) {
transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp.get());
}
}
void PayloadRouter::RegisterProcessThread(
void RtpVideoSender::RegisterProcessThread(
ProcessThread* module_process_thread) {
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
RTC_DCHECK(!module_process_thread_);
@ -270,13 +271,13 @@ void PayloadRouter::RegisterProcessThread(
module_process_thread_->RegisterModule(rtp_rtcp.get(), RTC_FROM_HERE);
}
void PayloadRouter::DeRegisterProcessThread() {
void RtpVideoSender::DeRegisterProcessThread() {
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
for (auto& rtp_rtcp : rtp_modules_)
module_process_thread_->DeRegisterModule(rtp_rtcp.get());
}
void PayloadRouter::SetActive(bool active) {
void RtpVideoSender::SetActive(bool active) {
rtc::CritScope lock(&crit_);
if (active_ == active)
return;
@ -284,7 +285,7 @@ void PayloadRouter::SetActive(bool active) {
SetActiveModules(active_modules);
}
void PayloadRouter::SetActiveModules(const std::vector<bool> active_modules) {
void RtpVideoSender::SetActiveModules(const std::vector<bool> active_modules) {
rtc::CritScope lock(&crit_);
RTC_DCHECK_EQ(rtp_modules_.size(), active_modules.size());
active_ = false;
@ -299,12 +300,12 @@ void PayloadRouter::SetActiveModules(const std::vector<bool> active_modules) {
}
}
bool PayloadRouter::IsActive() {
bool RtpVideoSender::IsActive() {
rtc::CritScope lock(&crit_);
return active_ && !rtp_modules_.empty();
}
EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
EncodedImageCallback::Result RtpVideoSender::OnEncodedImage(
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) {
@ -334,7 +335,7 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
return Result(Result::OK, frame_id);
}
void PayloadRouter::OnBitrateAllocationUpdated(
void RtpVideoSender::OnBitrateAllocationUpdated(
const VideoBitrateAllocation& bitrate) {
rtc::CritScope lock(&crit_);
if (IsActive()) {
@ -357,7 +358,7 @@ void PayloadRouter::OnBitrateAllocationUpdated(
}
}
void PayloadRouter::ConfigureProtection(const RtpConfig& rtp_config) {
void RtpVideoSender::ConfigureProtection(const RtpConfig& rtp_config) {
// Consistency of FlexFEC parameters is checked in MaybeCreateFlexfecSender.
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
@ -416,28 +417,28 @@ void PayloadRouter::ConfigureProtection(const RtpConfig& rtp_config) {
}
}
bool PayloadRouter::FecEnabled() const {
bool RtpVideoSender::FecEnabled() const {
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
int ulpfec_payload_type = rtp_config_.ulpfec.ulpfec_payload_type;
return flexfec_enabled || ulpfec_payload_type >= 0;
}
bool PayloadRouter::NackEnabled() const {
bool RtpVideoSender::NackEnabled() const {
const bool nack_enabled = rtp_config_.nack.rtp_history_ms > 0;
return nack_enabled;
}
void PayloadRouter::DeliverRtcp(const uint8_t* packet, size_t length) {
void RtpVideoSender::DeliverRtcp(const uint8_t* packet, size_t length) {
// Runs on a network thread.
for (auto& rtp_rtcp : rtp_modules_)
rtp_rtcp->IncomingRtcpPacket(packet, length);
}
void PayloadRouter::ProtectionRequest(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params,
uint32_t* sent_video_rate_bps,
uint32_t* sent_nack_rate_bps,
uint32_t* sent_fec_rate_bps) {
void RtpVideoSender::ProtectionRequest(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params,
uint32_t* sent_video_rate_bps,
uint32_t* sent_nack_rate_bps,
uint32_t* sent_fec_rate_bps) {
*sent_video_rate_bps = 0;
*sent_nack_rate_bps = 0;
*sent_fec_rate_bps = 0;
@ -455,13 +456,13 @@ void PayloadRouter::ProtectionRequest(const FecProtectionParams* delta_params,
}
}
void PayloadRouter::SetMaxRtpPacketSize(size_t max_rtp_packet_size) {
void RtpVideoSender::SetMaxRtpPacketSize(size_t max_rtp_packet_size) {
for (auto& rtp_rtcp : rtp_modules_) {
rtp_rtcp->SetMaxRtpPacketSize(max_rtp_packet_size);
}
}
void PayloadRouter::ConfigureSsrcs(const RtpConfig& rtp_config) {
void RtpVideoSender::ConfigureSsrcs(const RtpConfig& rtp_config) {
// Configure regular SSRCs.
for (size_t i = 0; i < rtp_config.ssrcs.size(); ++i) {
uint32_t ssrc = rtp_config.ssrcs[i];
@ -505,14 +506,14 @@ void PayloadRouter::ConfigureSsrcs(const RtpConfig& rtp_config) {
}
}
void PayloadRouter::OnNetworkAvailability(bool network_available) {
void RtpVideoSender::OnNetworkAvailability(bool network_available) {
for (auto& rtp_rtcp : rtp_modules_) {
rtp_rtcp->SetRTCPStatus(network_available ? rtp_config_.rtcp_mode
: RtcpMode::kOff);
}
}
std::map<uint32_t, RtpState> PayloadRouter::GetRtpStates() const {
std::map<uint32_t, RtpState> RtpVideoSender::GetRtpStates() const {
std::map<uint32_t, RtpState> rtp_states;
for (size_t i = 0; i < rtp_config_.ssrcs.size(); ++i) {
@ -534,7 +535,8 @@ std::map<uint32_t, RtpState> PayloadRouter::GetRtpStates() const {
return rtp_states;
}
std::map<uint32_t, RtpPayloadState> PayloadRouter::GetRtpPayloadStates() const {
std::map<uint32_t, RtpPayloadState> RtpVideoSender::GetRtpPayloadStates()
const {
rtc::CritScope lock(&crit_);
std::map<uint32_t, RtpPayloadState> payload_states;
for (const auto& param : params_) {

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_PAYLOAD_ROUTER_H_
#define CALL_PAYLOAD_ROUTER_H_
#ifndef CALL_RTP_VIDEO_SENDER_H_
#define CALL_RTP_VIDEO_SENDER_H_
#include <map>
#include <memory>
@ -20,7 +20,7 @@
#include "call/rtp_config.h"
#include "call/rtp_payload_params.h"
#include "call/rtp_transport_controller_send_interface.h"
#include "call/video_rtp_sender_interface.h"
#include "call/rtp_video_sender_interface.h"
#include "common_types.h" // NOLINT(build/include)
#include "logging/rtc_event_log/rtc_event_log.h"
#include "modules/rtp_rtcp/include/flexfec_sender.h"
@ -38,12 +38,12 @@ class RTPFragmentationHeader;
class RtpRtcp;
class RtpTransportControllerSendInterface;
// PayloadRouter routes outgoing data to the correct sending RTP module, based
// RtpVideoSender routes outgoing data to the correct sending RTP module, based
// on the simulcast layer in RTPVideoHeader.
class PayloadRouter : public VideoRtpSenderInterface {
class RtpVideoSender : public RtpVideoSenderInterface {
public:
// Rtp modules are assumed to be sorted in simulcast index order.
PayloadRouter(
RtpVideoSender(
const std::vector<uint32_t>& ssrcs,
std::map<uint32_t, RtpState> suspended_ssrcs,
const std::map<uint32_t, RtpPayloadState>& states,
@ -54,7 +54,7 @@ class PayloadRouter : public VideoRtpSenderInterface {
RtpTransportControllerSendInterface* transport,
RtcEventLog* event_log,
RateLimiter* retransmission_limiter); // move inside RtpTransport
~PayloadRouter() override;
~RtpVideoSender() override;
// RegisterProcessThread register |module_process_thread| with those objects
// that use it. Registration has to happen on the thread were
@ -64,7 +64,7 @@ class PayloadRouter : public VideoRtpSenderInterface {
void RegisterProcessThread(ProcessThread* module_process_thread) override;
void DeRegisterProcessThread() override;
// PayloadRouter will only route packets if being active, all packets will be
// RtpVideoSender will only route packets if being active, all packets will be
// dropped otherwise.
void SetActive(bool active) override;
// Sets the sending status of the rtp modules and appropriately sets the
@ -120,9 +120,9 @@ class PayloadRouter : public VideoRtpSenderInterface {
std::vector<RtpPayloadParams> params_ RTC_GUARDED_BY(crit_);
RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter);
RTC_DISALLOW_COPY_AND_ASSIGN(RtpVideoSender);
};
} // namespace webrtc
#endif // CALL_PAYLOAD_ROUTER_H_
#endif // CALL_RTP_VIDEO_SENDER_H_

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef CALL_VIDEO_RTP_SENDER_INTERFACE_H_
#define CALL_VIDEO_RTP_SENDER_INTERFACE_H_
#ifndef CALL_RTP_VIDEO_SENDER_INTERFACE_H_
#define CALL_RTP_VIDEO_SENDER_INTERFACE_H_
#include <map>
#include <vector>
@ -23,16 +23,16 @@ namespace webrtc {
class VideoBitrateAllocation;
struct FecProtectionParams;
class VideoRtpSenderInterface : public EncodedImageCallback {
class RtpVideoSenderInterface : public EncodedImageCallback {
public:
virtual void RegisterProcessThread(ProcessThread* module_process_thread) = 0;
virtual void DeRegisterProcessThread() = 0;
// PayloadRouter will only route packets if being active, all packets will be
// dropped otherwise.
// RtpVideoSender will only route packets if being active, all
// packets will be dropped otherwise.
virtual void SetActive(bool active) = 0;
// Sets the sending status of the rtp modules and appropriately sets the
// payload router to active if any rtp modules are active.
// RtpVideoSender to active if any rtp modules are active.
virtual void SetActiveModules(const std::vector<bool> active_modules) = 0;
virtual bool IsActive() = 0;
@ -57,4 +57,4 @@ class VideoRtpSenderInterface : public EncodedImageCallback {
const VideoBitrateAllocation& bitrate) = 0;
};
} // namespace webrtc
#endif // CALL_VIDEO_RTP_SENDER_INTERFACE_H_
#endif // CALL_RTP_VIDEO_SENDER_INTERFACE_H_

View File

@ -11,8 +11,8 @@
#include <memory>
#include <string>
#include "call/payload_router.h"
#include "call/rtp_transport_controller_send.h"
#include "call/rtp_video_sender.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "rtc_base/rate_limiter.h"
#include "test/field_trial.h"
@ -85,9 +85,9 @@ RtpSenderObservers CreateObservers(
return observers;
}
class PayloadRouterTestFixture {
class RtpVideoSenderTestFixture {
public:
PayloadRouterTestFixture(
RtpVideoSenderTestFixture(
const std::vector<uint32_t>& ssrcs,
int payload_type,
const std::map<uint32_t, RtpPayloadState>& suspended_payload_states)
@ -106,7 +106,7 @@ class PayloadRouterTestFixture {
}
config_.rtp.payload_type = payload_type;
std::map<uint32_t, RtpState> suspended_ssrcs;
router_ = absl::make_unique<PayloadRouter>(
router_ = absl::make_unique<RtpVideoSender>(
config_.rtp.ssrcs, suspended_ssrcs, suspended_payload_states,
config_.rtp, config_.rtcp, &transport_,
CreateObservers(&call_stats_, &encoder_feedback_, &stats_proxy_,
@ -116,7 +116,7 @@ class PayloadRouterTestFixture {
&transport_controller_, &event_log_, &retransmission_rate_limiter_);
}
PayloadRouter* router() { return router_.get(); }
RtpVideoSender* router() { return router_.get(); }
private:
NiceMock<MockTransport> transport_;
@ -133,11 +133,11 @@ class PayloadRouterTestFixture {
CallStats call_stats_;
SendStatisticsProxy stats_proxy_;
RateLimiter retransmission_rate_limiter_;
std::unique_ptr<PayloadRouter> router_;
std::unique_ptr<RtpVideoSender> router_;
};
} // namespace
TEST(PayloadRouterTest, SendOnOneModule) {
TEST(RtpVideoSenderTest, SendOnOneModule) {
uint8_t payload = 'a';
EncodedImage encoded_image;
encoded_image._timeStamp = 1;
@ -146,7 +146,7 @@ TEST(PayloadRouterTest, SendOnOneModule) {
encoded_image._buffer = &payload;
encoded_image._length = 1;
PayloadRouterTestFixture test({kSsrc1}, kPayloadType, {});
RtpVideoSenderTestFixture test({kSsrc1}, kPayloadType, {});
EXPECT_NE(
EncodedImageCallback::Result::OK,
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
@ -167,7 +167,7 @@ TEST(PayloadRouterTest, SendOnOneModule) {
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
}
TEST(PayloadRouterTest, SendSimulcastSetActive) {
TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
uint8_t payload = 'a';
EncodedImage encoded_image;
encoded_image._timeStamp = 1;
@ -176,7 +176,7 @@ TEST(PayloadRouterTest, SendSimulcastSetActive) {
encoded_image._buffer = &payload;
encoded_image._length = 1;
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
CodecSpecificInfo codec_info_1;
memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
@ -214,7 +214,7 @@ TEST(PayloadRouterTest, SendSimulcastSetActive) {
// behavior of the payload router. First sets one module to active and checks
// that outgoing data can be sent on this module, and checks that no data can
// be sent if both modules are inactive.
TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
uint8_t payload = 'a';
EncodedImage encoded_image;
encoded_image._timeStamp = 1;
@ -223,7 +223,7 @@ TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
encoded_image._buffer = &payload;
encoded_image._length = 1;
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
CodecSpecificInfo codec_info_1;
memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
codec_info_1.codecType = kVideoCodecVP8;
@ -258,8 +258,8 @@ TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
.error);
}
TEST(PayloadRouterTest, CreateWithNoPreviousStates) {
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) {
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
test.router()->SetActive(true);
std::map<uint32_t, RtpPayloadState> initial_states =
@ -269,7 +269,7 @@ TEST(PayloadRouterTest, CreateWithNoPreviousStates) {
EXPECT_NE(initial_states.find(kSsrc2), initial_states.end());
}
TEST(PayloadRouterTest, CreateWithPreviousStates) {
TEST(RtpVideoSenderTest, CreateWithPreviousStates) {
RtpPayloadState state1;
state1.picture_id = kInitialPictureId1;
state1.tl0_pic_idx = kInitialTl0PicIdx1;
@ -279,7 +279,7 @@ TEST(PayloadRouterTest, CreateWithPreviousStates) {
std::map<uint32_t, RtpPayloadState> states = {{kSsrc1, state1},
{kSsrc2, state2}};
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, states);
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, states);
test.router()->SetActive(true);
std::map<uint32_t, RtpPayloadState> initial_states =

View File

@ -30,8 +30,8 @@ class MockRtpTransportControllerSend
: public RtpTransportControllerSendInterface {
public:
MOCK_METHOD8(
CreateVideoRtpSender,
VideoRtpSenderInterface*(const std::vector<uint32_t>&,
CreateRtpVideoSender,
RtpVideoSenderInterface*(const std::vector<uint32_t>&,
std::map<uint32_t, RtpState>,
const std::map<uint32_t, RtpPayloadState>&,
const RtpConfig&,
@ -39,7 +39,7 @@ class MockRtpTransportControllerSend
Transport*,
const RtpSenderObservers&,
RtcEventLog*));
MOCK_METHOD1(DestroyVideoRtpSender, void(VideoRtpSenderInterface*));
MOCK_METHOD1(DestroyRtpVideoSender, void(RtpVideoSenderInterface*));
MOCK_METHOD0(GetWorkerQueue, rtc::TaskQueue*());
MOCK_METHOD0(packet_router, PacketRouter*());
MOCK_METHOD0(transport_feedback_observer, TransportFeedbackObserver*());

View File

@ -17,8 +17,6 @@
#include <vector>
#include "api/call/transport.h"
#include "api/rtp_headers.h"
#include "api/rtpparameters.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_source_interface.h"
#include "api/video_codecs/video_encoder_config.h"

View File

@ -17,7 +17,6 @@
#include "api/fec_controller.h"
#include "call/bitrate_allocator.h"
#include "call/payload_router.h"
#include "call/video_receive_stream.h"
#include "call/video_send_stream.h"
#include "common_video/libyuv/include/webrtc_libyuv.h"

View File

@ -111,16 +111,7 @@ int CalculatePacketRate(uint32_t bitrate_bps, size_t packet_size_bytes) {
return static_cast<int>((bitrate_bps + packet_size_bits - 1) /
packet_size_bits);
}
// call_stats,
// &encoder_feedback_,
// stats_proxy_,
// stats_proxy_,
// stats_proxy_,
// stats_proxy_,
// stats_proxy_,
// stats_proxy_,
// send_delay_stats,
// this
RtpSenderObservers CreateObservers(CallStats* call_stats,
EncoderRtcpFeedback* encoder_feedback,
SendStatisticsProxy* stats_proxy,
@ -229,8 +220,8 @@ VideoSendStreamImpl::VideoSendStreamImpl(
config_->rtp.ssrcs,
video_stream_encoder),
bandwidth_observer_(transport->GetBandwidthObserver()),
payload_router_(
transport_->CreateVideoRtpSender(config_->rtp.ssrcs,
rtp_video_sender_(
transport_->CreateRtpVideoSender(config_->rtp.ssrcs,
suspended_ssrcs,
suspended_payload_states,
config_->rtp,
@ -304,8 +295,8 @@ VideoSendStreamImpl::VideoSendStreamImpl(
// Currently, both ULPFEC and FlexFEC use the same FEC rate calculation logic,
// so enable that logic if either of those FEC schemes are enabled.
fec_controller_->SetProtectionMethod(payload_router_->FecEnabled(),
payload_router_->NackEnabled());
fec_controller_->SetProtectionMethod(rtp_video_sender_->FecEnabled(),
rtp_video_sender_->NackEnabled());
fec_controller_->SetProtectionCallback(this);
// Signal congestion controller this object is ready for OnPacket* callbacks.
@ -335,28 +326,28 @@ VideoSendStreamImpl::VideoSendStreamImpl(
VideoSendStreamImpl::~VideoSendStreamImpl() {
RTC_DCHECK_RUN_ON(worker_queue_);
RTC_DCHECK(!payload_router_->IsActive())
RTC_DCHECK(!rtp_video_sender_->IsActive())
<< "VideoSendStreamImpl::Stop not called";
RTC_LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString();
if (fec_controller_->UseLossVectorMask()) {
transport_->DeRegisterPacketFeedbackObserver(this);
}
transport_->DestroyVideoRtpSender(payload_router_);
transport_->DestroyRtpVideoSender(rtp_video_sender_);
}
void VideoSendStreamImpl::RegisterProcessThread(
ProcessThread* module_process_thread) {
payload_router_->RegisterProcessThread(module_process_thread);
rtp_video_sender_->RegisterProcessThread(module_process_thread);
}
void VideoSendStreamImpl::DeRegisterProcessThread() {
payload_router_->DeRegisterProcessThread();
rtp_video_sender_->DeRegisterProcessThread();
}
bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) {
// Runs on a network thread.
RTC_DCHECK(!worker_queue_->IsCurrent());
payload_router_->DeliverRtcp(packet, length);
rtp_video_sender_->DeliverRtcp(packet, length);
return true;
}
@ -364,12 +355,12 @@ void VideoSendStreamImpl::UpdateActiveSimulcastLayers(
const std::vector<bool> active_layers) {
RTC_DCHECK_RUN_ON(worker_queue_);
RTC_LOG(LS_INFO) << "VideoSendStream::UpdateActiveSimulcastLayers";
bool previously_active = payload_router_->IsActive();
payload_router_->SetActiveModules(active_layers);
if (!payload_router_->IsActive() && previously_active) {
bool previously_active = rtp_video_sender_->IsActive();
rtp_video_sender_->SetActiveModules(active_layers);
if (!rtp_video_sender_->IsActive() && previously_active) {
// Payload router switched from active to inactive.
StopVideoSendStream();
} else if (payload_router_->IsActive() && !previously_active) {
} else if (rtp_video_sender_->IsActive() && !previously_active) {
// Payload router switched from inactive to active.
StartupVideoSendStream();
}
@ -378,10 +369,10 @@ void VideoSendStreamImpl::UpdateActiveSimulcastLayers(
void VideoSendStreamImpl::Start() {
RTC_DCHECK_RUN_ON(worker_queue_);
RTC_LOG(LS_INFO) << "VideoSendStream::Start";
if (payload_router_->IsActive())
if (rtp_video_sender_->IsActive())
return;
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start");
payload_router_->SetActive(true);
rtp_video_sender_->SetActive(true);
StartupVideoSendStream();
}
@ -410,10 +401,10 @@ void VideoSendStreamImpl::StartupVideoSendStream() {
void VideoSendStreamImpl::Stop() {
RTC_DCHECK_RUN_ON(worker_queue_);
RTC_LOG(LS_INFO) << "VideoSendStream::Stop";
if (!payload_router_->IsActive())
if (!rtp_video_sender_->IsActive())
return;
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop");
payload_router_->SetActive(false);
rtp_video_sender_->SetActive(false);
StopVideoSendStream();
}
@ -441,7 +432,7 @@ void VideoSendStreamImpl::SignalEncoderTimedOut() {
void VideoSendStreamImpl::OnBitrateAllocationUpdated(
const VideoBitrateAllocation& allocation) {
payload_router_->OnBitrateAllocationUpdated(allocation);
rtp_video_sender_->OnBitrateAllocationUpdated(allocation);
}
void VideoSendStreamImpl::SignalEncoderActive() {
@ -511,7 +502,7 @@ void VideoSendStreamImpl::OnEncoderConfigurationChanged(
num_temporal_layers,
config_->rtp.max_packet_size);
if (payload_router_->IsActive()) {
if (rtp_video_sender_->IsActive()) {
// The send stream is started already. Update the allocator with new bitrate
// limits.
bitrate_allocator_->AddObserver(
@ -548,7 +539,7 @@ EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage(
fec_controller_->UpdateWithEncodedData(encoded_image._length,
encoded_image._frameType);
EncodedImageCallback::Result result = payload_router_->OnEncodedImage(
EncodedImageCallback::Result result = rtp_video_sender_->OnEncodedImage(
encoded_image, codec_specific_info, fragmentation);
RTC_DCHECK(codec_specific_info);
@ -569,12 +560,12 @@ EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage(
}
std::map<uint32_t, RtpState> VideoSendStreamImpl::GetRtpStates() const {
return payload_router_->GetRtpStates();
return rtp_video_sender_->GetRtpStates();
}
std::map<uint32_t, RtpPayloadState> VideoSendStreamImpl::GetRtpPayloadStates()
const {
return payload_router_->GetRtpPayloadStates();
return rtp_video_sender_->GetRtpPayloadStates();
}
uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps,
@ -582,7 +573,7 @@ uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps,
int64_t rtt,
int64_t probing_interval_ms) {
RTC_DCHECK_RUN_ON(worker_queue_);
RTC_DCHECK(payload_router_->IsActive())
RTC_DCHECK(rtp_video_sender_->IsActive())
<< "VideoSendStream::Start has not been called.";
// Substract overhead from bitrate.
@ -657,9 +648,9 @@ int VideoSendStreamImpl::ProtectionRequest(
uint32_t* sent_nack_rate_bps,
uint32_t* sent_fec_rate_bps) {
RTC_DCHECK_RUN_ON(worker_queue_);
payload_router_->ProtectionRequest(delta_params, key_params,
sent_video_rate_bps, sent_nack_rate_bps,
sent_fec_rate_bps);
rtp_video_sender_->ProtectionRequest(delta_params, key_params,
sent_video_rate_bps, sent_nack_rate_bps,
sent_fec_rate_bps);
return 0;
}
@ -681,7 +672,7 @@ void VideoSendStreamImpl::SetTransportOverhead(
std::min(config_->rtp.max_packet_size,
kPathMTU - transport_overhead_bytes_per_packet_);
payload_router_->SetMaxRtpPacketSize(rtp_packet_size);
rtp_video_sender_->SetMaxRtpPacketSize(rtp_packet_size);
}
void VideoSendStreamImpl::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) {

View File

@ -16,7 +16,7 @@
#include <vector>
#include "call/bitrate_allocator.h"
#include "call/payload_router.h"
#include "call/rtp_video_sender_interface.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/include/video_bitrate_allocator.h"
#include "modules/utility/include/process_thread.h"
@ -170,7 +170,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
EncoderRtcpFeedback encoder_feedback_;
RtcpBandwidthObserver* const bandwidth_observer_;
VideoRtpSenderInterface* const payload_router_;
RtpVideoSenderInterface* const rtp_video_sender_;
// |weak_ptr_| to our self. This is used since we can not call
// |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy

View File

@ -10,7 +10,7 @@
#include <string>
#include "call/payload_router.h"
#include "call/rtp_video_sender.h"
#include "call/test/mock_bitrate_allocator.h"
#include "call/test/mock_rtp_transport_controller_send.h"
#include "logging/rtc_event_log/rtc_event_log.h"
@ -44,7 +44,7 @@ std::string GetAlrProbingExperimentString() {
AlrExperimentSettings::kScreenshareProbingBweExperimentName) +
"/1.0,2875,80,40,-60,3/";
}
class MockPayloadRouter : public VideoRtpSenderInterface {
class MockPayloadRouter : public RtpVideoSenderInterface {
public:
MOCK_METHOD1(RegisterProcessThread, void(ProcessThread*));
MOCK_METHOD0(DeRegisterProcessThread, void());
@ -93,7 +93,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
EXPECT_CALL(transport_controller_, packet_router())
.WillRepeatedly(Return(&packet_router_));
EXPECT_CALL(transport_controller_,
CreateVideoRtpSender(_, _, _, _, _, _, _, _))
CreateRtpVideoSender(_, _, _, _, _, _, _, _))
.WillRepeatedly(Return(&payload_router_));
EXPECT_CALL(payload_router_, SetActive(_))
.WillRepeatedly(testing::Invoke(

View File

@ -14,7 +14,6 @@
#include <map>
#include <vector>
#include "call/payload_router.h"
#include "modules/video_coding/video_coding_impl.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"