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:

committed by
Commit Bot

parent
692409f8e7
commit
9416ef8c4f
@ -100,13 +100,13 @@ rtc_source_set("rtp_receiver") {
|
|||||||
|
|
||||||
rtc_source_set("rtp_sender") {
|
rtc_source_set("rtp_sender") {
|
||||||
sources = [
|
sources = [
|
||||||
"payload_router.cc",
|
|
||||||
"payload_router.h",
|
|
||||||
"rtp_payload_params.cc",
|
"rtp_payload_params.cc",
|
||||||
"rtp_payload_params.h",
|
"rtp_payload_params.h",
|
||||||
"rtp_transport_controller_send.cc",
|
"rtp_transport_controller_send.cc",
|
||||||
"rtp_transport_controller_send.h",
|
"rtp_transport_controller_send.h",
|
||||||
"video_rtp_sender_interface.h",
|
"rtp_video_sender.cc",
|
||||||
|
"rtp_video_sender.h",
|
||||||
|
"rtp_video_sender_interface.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":bitrate_configurator",
|
":bitrate_configurator",
|
||||||
@ -284,13 +284,13 @@ if (rtc_include_tests) {
|
|||||||
"bitrate_estimator_tests.cc",
|
"bitrate_estimator_tests.cc",
|
||||||
"call_unittest.cc",
|
"call_unittest.cc",
|
||||||
"flexfec_receive_stream_unittest.cc",
|
"flexfec_receive_stream_unittest.cc",
|
||||||
"payload_router_unittest.cc",
|
|
||||||
"receive_time_calculator_unittest.cc",
|
"receive_time_calculator_unittest.cc",
|
||||||
"rtcp_demuxer_unittest.cc",
|
"rtcp_demuxer_unittest.cc",
|
||||||
"rtp_bitrate_configurator_unittest.cc",
|
"rtp_bitrate_configurator_unittest.cc",
|
||||||
"rtp_demuxer_unittest.cc",
|
"rtp_demuxer_unittest.cc",
|
||||||
"rtp_payload_params_unittest.cc",
|
"rtp_payload_params_unittest.cc",
|
||||||
"rtp_rtcp_demuxer_helper_unittest.cc",
|
"rtp_rtcp_demuxer_helper_unittest.cc",
|
||||||
|
"rtp_video_sender_unittest.cc",
|
||||||
"rtx_receive_stream_unittest.cc",
|
"rtx_receive_stream_unittest.cc",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "call/payload_router.h"
|
#include "call/rtp_payload_params.h"
|
||||||
#include "modules/video_coding/include/video_codec_interface.h"
|
#include "modules/video_coding/include/video_codec_interface.h"
|
||||||
#include "test/gtest.h"
|
#include "test/gtest.h"
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ RtpTransportControllerSend::~RtpTransportControllerSend() {
|
|||||||
process_thread_->DeRegisterModule(&pacer_);
|
process_thread_->DeRegisterModule(&pacer_);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
|
RtpVideoSenderInterface* RtpTransportControllerSend::CreateRtpVideoSender(
|
||||||
const std::vector<uint32_t>& ssrcs,
|
const std::vector<uint32_t>& ssrcs,
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs,
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
||||||
const std::map<uint32_t, RtpPayloadState>& states,
|
const std::map<uint32_t, RtpPayloadState>& states,
|
||||||
@ -93,7 +93,7 @@ VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
|
|||||||
Transport* send_transport,
|
Transport* send_transport,
|
||||||
const RtpSenderObservers& observers,
|
const RtpSenderObservers& observers,
|
||||||
RtcEventLog* event_log) {
|
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,
|
ssrcs, suspended_ssrcs, states, rtp_config, rtcp_config, send_transport,
|
||||||
observers,
|
observers,
|
||||||
// TODO(holmer): Remove this circular dependency by injecting
|
// TODO(holmer): Remove this circular dependency by injecting
|
||||||
@ -102,9 +102,9 @@ VideoRtpSenderInterface* RtpTransportControllerSend::CreateVideoRtpSender(
|
|||||||
return video_rtp_senders_.back().get();
|
return video_rtp_senders_.back().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RtpTransportControllerSend::DestroyVideoRtpSender(
|
void RtpTransportControllerSend::DestroyRtpVideoSender(
|
||||||
VideoRtpSenderInterface* rtp_video_sender) {
|
RtpVideoSenderInterface* rtp_video_sender) {
|
||||||
std::vector<std::unique_ptr<VideoRtpSenderInterface>>::iterator it =
|
std::vector<std::unique_ptr<RtpVideoSenderInterface>>::iterator it =
|
||||||
video_rtp_senders_.end();
|
video_rtp_senders_.end();
|
||||||
for (it = video_rtp_senders_.begin(); it != video_rtp_senders_.end(); ++it) {
|
for (it = video_rtp_senders_.begin(); it != video_rtp_senders_.end(); ++it) {
|
||||||
if (it->get() == rtp_video_sender) {
|
if (it->get() == rtp_video_sender) {
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/transport/network_control.h"
|
#include "api/transport/network_control.h"
|
||||||
#include "call/payload_router.h"
|
|
||||||
#include "call/rtp_bitrate_configurator.h"
|
#include "call/rtp_bitrate_configurator.h"
|
||||||
#include "call/rtp_transport_controller_send_interface.h"
|
#include "call/rtp_transport_controller_send_interface.h"
|
||||||
|
#include "call/rtp_video_sender.h"
|
||||||
#include "common_types.h" // NOLINT(build/include)
|
#include "common_types.h" // NOLINT(build/include)
|
||||||
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
|
#include "modules/congestion_controller/include/send_side_congestion_controller_interface.h"
|
||||||
#include "modules/pacing/packet_router.h"
|
#include "modules/pacing/packet_router.h"
|
||||||
@ -46,7 +46,7 @@ class RtpTransportControllerSend final
|
|||||||
const BitrateConstraints& bitrate_config);
|
const BitrateConstraints& bitrate_config);
|
||||||
~RtpTransportControllerSend() override;
|
~RtpTransportControllerSend() override;
|
||||||
|
|
||||||
VideoRtpSenderInterface* CreateVideoRtpSender(
|
RtpVideoSenderInterface* CreateRtpVideoSender(
|
||||||
const std::vector<uint32_t>& ssrcs,
|
const std::vector<uint32_t>& ssrcs,
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs,
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
||||||
const std::map<uint32_t, RtpPayloadState>&
|
const std::map<uint32_t, RtpPayloadState>&
|
||||||
@ -56,8 +56,8 @@ class RtpTransportControllerSend final
|
|||||||
Transport* send_transport,
|
Transport* send_transport,
|
||||||
const RtpSenderObservers& observers,
|
const RtpSenderObservers& observers,
|
||||||
RtcEventLog* event_log) override;
|
RtcEventLog* event_log) override;
|
||||||
void DestroyVideoRtpSender(
|
void DestroyRtpVideoSender(
|
||||||
VideoRtpSenderInterface* rtp_video_sender) override;
|
RtpVideoSenderInterface* rtp_video_sender) override;
|
||||||
|
|
||||||
// Implements NetworkChangedObserver interface.
|
// Implements NetworkChangedObserver interface.
|
||||||
void OnNetworkChanged(uint32_t bitrate_bps,
|
void OnNetworkChanged(uint32_t bitrate_bps,
|
||||||
@ -105,7 +105,7 @@ class RtpTransportControllerSend final
|
|||||||
private:
|
private:
|
||||||
const Clock* const clock_;
|
const Clock* const clock_;
|
||||||
PacketRouter packet_router_;
|
PacketRouter packet_router_;
|
||||||
std::vector<std::unique_ptr<VideoRtpSenderInterface>> video_rtp_senders_;
|
std::vector<std::unique_ptr<RtpVideoSenderInterface>> video_rtp_senders_;
|
||||||
PacedSender pacer_;
|
PacedSender pacer_;
|
||||||
RtpKeepAliveConfig keepalive_;
|
RtpKeepAliveConfig keepalive_;
|
||||||
RtpBitrateConfigurator bitrate_configurator_;
|
RtpBitrateConfigurator bitrate_configurator_;
|
||||||
|
@ -39,7 +39,7 @@ class Module;
|
|||||||
class PacedSender;
|
class PacedSender;
|
||||||
class PacketFeedbackObserver;
|
class PacketFeedbackObserver;
|
||||||
class PacketRouter;
|
class PacketRouter;
|
||||||
class VideoRtpSenderInterface;
|
class RtpVideoSenderInterface;
|
||||||
class RateLimiter;
|
class RateLimiter;
|
||||||
class RtcpBandwidthObserver;
|
class RtcpBandwidthObserver;
|
||||||
class RtpPacketSender;
|
class RtpPacketSender;
|
||||||
@ -90,7 +90,7 @@ class RtpTransportControllerSendInterface {
|
|||||||
virtual rtc::TaskQueue* GetWorkerQueue() = 0;
|
virtual rtc::TaskQueue* GetWorkerQueue() = 0;
|
||||||
virtual PacketRouter* packet_router() = 0;
|
virtual PacketRouter* packet_router() = 0;
|
||||||
|
|
||||||
virtual VideoRtpSenderInterface* CreateVideoRtpSender(
|
virtual RtpVideoSenderInterface* CreateRtpVideoSender(
|
||||||
const std::vector<uint32_t>& ssrcs,
|
const std::vector<uint32_t>& ssrcs,
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs,
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
||||||
// TODO(holmer): Move states into RtpTransportControllerSend.
|
// TODO(holmer): Move states into RtpTransportControllerSend.
|
||||||
@ -100,8 +100,8 @@ class RtpTransportControllerSendInterface {
|
|||||||
Transport* send_transport,
|
Transport* send_transport,
|
||||||
const RtpSenderObservers& observers,
|
const RtpSenderObservers& observers,
|
||||||
RtcEventLog* event_log) = 0;
|
RtcEventLog* event_log) = 0;
|
||||||
virtual void DestroyVideoRtpSender(
|
virtual void DestroyRtpVideoSender(
|
||||||
VideoRtpSenderInterface* rtp_video_sender) = 0;
|
RtpVideoSenderInterface* rtp_video_sender) = 0;
|
||||||
|
|
||||||
virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
|
virtual TransportFeedbackObserver* transport_feedback_observer() = 0;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* 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 <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -161,7 +161,8 @@ std::unique_ptr<FlexfecSender> MaybeCreateFlexfecSender(
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
PayloadRouter::PayloadRouter(const std::vector<uint32_t>& ssrcs,
|
RtpVideoSender::RtpVideoSender(
|
||||||
|
const std::vector<uint32_t>& ssrcs,
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs,
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
||||||
const std::map<uint32_t, RtpPayloadState>& states,
|
const std::map<uint32_t, RtpPayloadState>& states,
|
||||||
const RtpConfig& rtp_config,
|
const RtpConfig& rtp_config,
|
||||||
@ -254,13 +255,13 @@ PayloadRouter::PayloadRouter(const std::vector<uint32_t>& ssrcs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PayloadRouter::~PayloadRouter() {
|
RtpVideoSender::~RtpVideoSender() {
|
||||||
for (auto& rtp_rtcp : rtp_modules_) {
|
for (auto& rtp_rtcp : rtp_modules_) {
|
||||||
transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp.get());
|
transport_->packet_router()->RemoveSendRtpModule(rtp_rtcp.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::RegisterProcessThread(
|
void RtpVideoSender::RegisterProcessThread(
|
||||||
ProcessThread* module_process_thread) {
|
ProcessThread* module_process_thread) {
|
||||||
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
||||||
RTC_DCHECK(!module_process_thread_);
|
RTC_DCHECK(!module_process_thread_);
|
||||||
@ -270,13 +271,13 @@ void PayloadRouter::RegisterProcessThread(
|
|||||||
module_process_thread_->RegisterModule(rtp_rtcp.get(), RTC_FROM_HERE);
|
module_process_thread_->RegisterModule(rtp_rtcp.get(), RTC_FROM_HERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::DeRegisterProcessThread() {
|
void RtpVideoSender::DeRegisterProcessThread() {
|
||||||
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
|
||||||
for (auto& rtp_rtcp : rtp_modules_)
|
for (auto& rtp_rtcp : rtp_modules_)
|
||||||
module_process_thread_->DeRegisterModule(rtp_rtcp.get());
|
module_process_thread_->DeRegisterModule(rtp_rtcp.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::SetActive(bool active) {
|
void RtpVideoSender::SetActive(bool active) {
|
||||||
rtc::CritScope lock(&crit_);
|
rtc::CritScope lock(&crit_);
|
||||||
if (active_ == active)
|
if (active_ == active)
|
||||||
return;
|
return;
|
||||||
@ -284,7 +285,7 @@ void PayloadRouter::SetActive(bool active) {
|
|||||||
SetActiveModules(active_modules);
|
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::CritScope lock(&crit_);
|
||||||
RTC_DCHECK_EQ(rtp_modules_.size(), active_modules.size());
|
RTC_DCHECK_EQ(rtp_modules_.size(), active_modules.size());
|
||||||
active_ = false;
|
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_);
|
rtc::CritScope lock(&crit_);
|
||||||
return active_ && !rtp_modules_.empty();
|
return active_ && !rtp_modules_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
|
EncodedImageCallback::Result RtpVideoSender::OnEncodedImage(
|
||||||
const EncodedImage& encoded_image,
|
const EncodedImage& encoded_image,
|
||||||
const CodecSpecificInfo* codec_specific_info,
|
const CodecSpecificInfo* codec_specific_info,
|
||||||
const RTPFragmentationHeader* fragmentation) {
|
const RTPFragmentationHeader* fragmentation) {
|
||||||
@ -334,7 +335,7 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
|
|||||||
return Result(Result::OK, frame_id);
|
return Result(Result::OK, frame_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::OnBitrateAllocationUpdated(
|
void RtpVideoSender::OnBitrateAllocationUpdated(
|
||||||
const VideoBitrateAllocation& bitrate) {
|
const VideoBitrateAllocation& bitrate) {
|
||||||
rtc::CritScope lock(&crit_);
|
rtc::CritScope lock(&crit_);
|
||||||
if (IsActive()) {
|
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.
|
// Consistency of FlexFEC parameters is checked in MaybeCreateFlexfecSender.
|
||||||
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
|
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
|
||||||
|
|
||||||
@ -416,24 +417,24 @@ void PayloadRouter::ConfigureProtection(const RtpConfig& rtp_config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PayloadRouter::FecEnabled() const {
|
bool RtpVideoSender::FecEnabled() const {
|
||||||
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
|
const bool flexfec_enabled = (flexfec_sender_ != nullptr);
|
||||||
int ulpfec_payload_type = rtp_config_.ulpfec.ulpfec_payload_type;
|
int ulpfec_payload_type = rtp_config_.ulpfec.ulpfec_payload_type;
|
||||||
return flexfec_enabled || ulpfec_payload_type >= 0;
|
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;
|
const bool nack_enabled = rtp_config_.nack.rtp_history_ms > 0;
|
||||||
return nack_enabled;
|
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.
|
// Runs on a network thread.
|
||||||
for (auto& rtp_rtcp : rtp_modules_)
|
for (auto& rtp_rtcp : rtp_modules_)
|
||||||
rtp_rtcp->IncomingRtcpPacket(packet, length);
|
rtp_rtcp->IncomingRtcpPacket(packet, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::ProtectionRequest(const FecProtectionParams* delta_params,
|
void RtpVideoSender::ProtectionRequest(const FecProtectionParams* delta_params,
|
||||||
const FecProtectionParams* key_params,
|
const FecProtectionParams* key_params,
|
||||||
uint32_t* sent_video_rate_bps,
|
uint32_t* sent_video_rate_bps,
|
||||||
uint32_t* sent_nack_rate_bps,
|
uint32_t* sent_nack_rate_bps,
|
||||||
@ -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_) {
|
for (auto& rtp_rtcp : rtp_modules_) {
|
||||||
rtp_rtcp->SetMaxRtpPacketSize(max_rtp_packet_size);
|
rtp_rtcp->SetMaxRtpPacketSize(max_rtp_packet_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PayloadRouter::ConfigureSsrcs(const RtpConfig& rtp_config) {
|
void RtpVideoSender::ConfigureSsrcs(const RtpConfig& rtp_config) {
|
||||||
// Configure regular SSRCs.
|
// Configure regular SSRCs.
|
||||||
for (size_t i = 0; i < rtp_config.ssrcs.size(); ++i) {
|
for (size_t i = 0; i < rtp_config.ssrcs.size(); ++i) {
|
||||||
uint32_t ssrc = rtp_config.ssrcs[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_) {
|
for (auto& rtp_rtcp : rtp_modules_) {
|
||||||
rtp_rtcp->SetRTCPStatus(network_available ? rtp_config_.rtcp_mode
|
rtp_rtcp->SetRTCPStatus(network_available ? rtp_config_.rtcp_mode
|
||||||
: RtcpMode::kOff);
|
: 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;
|
std::map<uint32_t, RtpState> rtp_states;
|
||||||
|
|
||||||
for (size_t i = 0; i < rtp_config_.ssrcs.size(); ++i) {
|
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;
|
return rtp_states;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, RtpPayloadState> PayloadRouter::GetRtpPayloadStates() const {
|
std::map<uint32_t, RtpPayloadState> RtpVideoSender::GetRtpPayloadStates()
|
||||||
|
const {
|
||||||
rtc::CritScope lock(&crit_);
|
rtc::CritScope lock(&crit_);
|
||||||
std::map<uint32_t, RtpPayloadState> payload_states;
|
std::map<uint32_t, RtpPayloadState> payload_states;
|
||||||
for (const auto& param : params_) {
|
for (const auto& param : params_) {
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CALL_PAYLOAD_ROUTER_H_
|
#ifndef CALL_RTP_VIDEO_SENDER_H_
|
||||||
#define CALL_PAYLOAD_ROUTER_H_
|
#define CALL_RTP_VIDEO_SENDER_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#include "call/rtp_config.h"
|
#include "call/rtp_config.h"
|
||||||
#include "call/rtp_payload_params.h"
|
#include "call/rtp_payload_params.h"
|
||||||
#include "call/rtp_transport_controller_send_interface.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 "common_types.h" // NOLINT(build/include)
|
||||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||||
#include "modules/rtp_rtcp/include/flexfec_sender.h"
|
#include "modules/rtp_rtcp/include/flexfec_sender.h"
|
||||||
@ -38,12 +38,12 @@ class RTPFragmentationHeader;
|
|||||||
class RtpRtcp;
|
class RtpRtcp;
|
||||||
class RtpTransportControllerSendInterface;
|
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.
|
// on the simulcast layer in RTPVideoHeader.
|
||||||
class PayloadRouter : public VideoRtpSenderInterface {
|
class RtpVideoSender : public RtpVideoSenderInterface {
|
||||||
public:
|
public:
|
||||||
// Rtp modules are assumed to be sorted in simulcast index order.
|
// Rtp modules are assumed to be sorted in simulcast index order.
|
||||||
PayloadRouter(
|
RtpVideoSender(
|
||||||
const std::vector<uint32_t>& ssrcs,
|
const std::vector<uint32_t>& ssrcs,
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs,
|
std::map<uint32_t, RtpState> suspended_ssrcs,
|
||||||
const std::map<uint32_t, RtpPayloadState>& states,
|
const std::map<uint32_t, RtpPayloadState>& states,
|
||||||
@ -54,7 +54,7 @@ class PayloadRouter : public VideoRtpSenderInterface {
|
|||||||
RtpTransportControllerSendInterface* transport,
|
RtpTransportControllerSendInterface* transport,
|
||||||
RtcEventLog* event_log,
|
RtcEventLog* event_log,
|
||||||
RateLimiter* retransmission_limiter); // move inside RtpTransport
|
RateLimiter* retransmission_limiter); // move inside RtpTransport
|
||||||
~PayloadRouter() override;
|
~RtpVideoSender() override;
|
||||||
|
|
||||||
// RegisterProcessThread register |module_process_thread| with those objects
|
// RegisterProcessThread register |module_process_thread| with those objects
|
||||||
// that use it. Registration has to happen on the thread were
|
// 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 RegisterProcessThread(ProcessThread* module_process_thread) override;
|
||||||
void DeRegisterProcessThread() 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.
|
// dropped otherwise.
|
||||||
void SetActive(bool active) override;
|
void SetActive(bool active) override;
|
||||||
// Sets the sending status of the rtp modules and appropriately sets the
|
// 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_);
|
std::vector<RtpPayloadParams> params_ RTC_GUARDED_BY(crit_);
|
||||||
|
|
||||||
RTC_DISALLOW_COPY_AND_ASSIGN(PayloadRouter);
|
RTC_DISALLOW_COPY_AND_ASSIGN(RtpVideoSender);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // CALL_PAYLOAD_ROUTER_H_
|
#endif // CALL_RTP_VIDEO_SENDER_H_
|
@ -8,8 +8,8 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CALL_VIDEO_RTP_SENDER_INTERFACE_H_
|
#ifndef CALL_RTP_VIDEO_SENDER_INTERFACE_H_
|
||||||
#define CALL_VIDEO_RTP_SENDER_INTERFACE_H_
|
#define CALL_RTP_VIDEO_SENDER_INTERFACE_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -23,16 +23,16 @@ namespace webrtc {
|
|||||||
class VideoBitrateAllocation;
|
class VideoBitrateAllocation;
|
||||||
struct FecProtectionParams;
|
struct FecProtectionParams;
|
||||||
|
|
||||||
class VideoRtpSenderInterface : public EncodedImageCallback {
|
class RtpVideoSenderInterface : public EncodedImageCallback {
|
||||||
public:
|
public:
|
||||||
virtual void RegisterProcessThread(ProcessThread* module_process_thread) = 0;
|
virtual void RegisterProcessThread(ProcessThread* module_process_thread) = 0;
|
||||||
virtual void DeRegisterProcessThread() = 0;
|
virtual void DeRegisterProcessThread() = 0;
|
||||||
|
|
||||||
// PayloadRouter will only route packets if being active, all packets will be
|
// RtpVideoSender will only route packets if being active, all
|
||||||
// dropped otherwise.
|
// packets will be dropped otherwise.
|
||||||
virtual void SetActive(bool active) = 0;
|
virtual void SetActive(bool active) = 0;
|
||||||
// Sets the sending status of the rtp modules and appropriately sets the
|
// 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 void SetActiveModules(const std::vector<bool> active_modules) = 0;
|
||||||
virtual bool IsActive() = 0;
|
virtual bool IsActive() = 0;
|
||||||
|
|
||||||
@ -57,4 +57,4 @@ class VideoRtpSenderInterface : public EncodedImageCallback {
|
|||||||
const VideoBitrateAllocation& bitrate) = 0;
|
const VideoBitrateAllocation& bitrate) = 0;
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // CALL_VIDEO_RTP_SENDER_INTERFACE_H_
|
#endif // CALL_RTP_VIDEO_SENDER_INTERFACE_H_
|
@ -11,8 +11,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "call/payload_router.h"
|
|
||||||
#include "call/rtp_transport_controller_send.h"
|
#include "call/rtp_transport_controller_send.h"
|
||||||
|
#include "call/rtp_video_sender.h"
|
||||||
#include "modules/video_coding/include/video_codec_interface.h"
|
#include "modules/video_coding/include/video_codec_interface.h"
|
||||||
#include "rtc_base/rate_limiter.h"
|
#include "rtc_base/rate_limiter.h"
|
||||||
#include "test/field_trial.h"
|
#include "test/field_trial.h"
|
||||||
@ -85,9 +85,9 @@ RtpSenderObservers CreateObservers(
|
|||||||
return observers;
|
return observers;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PayloadRouterTestFixture {
|
class RtpVideoSenderTestFixture {
|
||||||
public:
|
public:
|
||||||
PayloadRouterTestFixture(
|
RtpVideoSenderTestFixture(
|
||||||
const std::vector<uint32_t>& ssrcs,
|
const std::vector<uint32_t>& ssrcs,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const std::map<uint32_t, RtpPayloadState>& suspended_payload_states)
|
const std::map<uint32_t, RtpPayloadState>& suspended_payload_states)
|
||||||
@ -106,7 +106,7 @@ class PayloadRouterTestFixture {
|
|||||||
}
|
}
|
||||||
config_.rtp.payload_type = payload_type;
|
config_.rtp.payload_type = payload_type;
|
||||||
std::map<uint32_t, RtpState> suspended_ssrcs;
|
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.ssrcs, suspended_ssrcs, suspended_payload_states,
|
||||||
config_.rtp, config_.rtcp, &transport_,
|
config_.rtp, config_.rtcp, &transport_,
|
||||||
CreateObservers(&call_stats_, &encoder_feedback_, &stats_proxy_,
|
CreateObservers(&call_stats_, &encoder_feedback_, &stats_proxy_,
|
||||||
@ -116,7 +116,7 @@ class PayloadRouterTestFixture {
|
|||||||
&transport_controller_, &event_log_, &retransmission_rate_limiter_);
|
&transport_controller_, &event_log_, &retransmission_rate_limiter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
PayloadRouter* router() { return router_.get(); }
|
RtpVideoSender* router() { return router_.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NiceMock<MockTransport> transport_;
|
NiceMock<MockTransport> transport_;
|
||||||
@ -133,11 +133,11 @@ class PayloadRouterTestFixture {
|
|||||||
CallStats call_stats_;
|
CallStats call_stats_;
|
||||||
SendStatisticsProxy stats_proxy_;
|
SendStatisticsProxy stats_proxy_;
|
||||||
RateLimiter retransmission_rate_limiter_;
|
RateLimiter retransmission_rate_limiter_;
|
||||||
std::unique_ptr<PayloadRouter> router_;
|
std::unique_ptr<RtpVideoSender> router_;
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(PayloadRouterTest, SendOnOneModule) {
|
TEST(RtpVideoSenderTest, SendOnOneModule) {
|
||||||
uint8_t payload = 'a';
|
uint8_t payload = 'a';
|
||||||
EncodedImage encoded_image;
|
EncodedImage encoded_image;
|
||||||
encoded_image._timeStamp = 1;
|
encoded_image._timeStamp = 1;
|
||||||
@ -146,7 +146,7 @@ TEST(PayloadRouterTest, SendOnOneModule) {
|
|||||||
encoded_image._buffer = &payload;
|
encoded_image._buffer = &payload;
|
||||||
encoded_image._length = 1;
|
encoded_image._length = 1;
|
||||||
|
|
||||||
PayloadRouterTestFixture test({kSsrc1}, kPayloadType, {});
|
RtpVideoSenderTestFixture test({kSsrc1}, kPayloadType, {});
|
||||||
EXPECT_NE(
|
EXPECT_NE(
|
||||||
EncodedImageCallback::Result::OK,
|
EncodedImageCallback::Result::OK,
|
||||||
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
|
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
|
||||||
@ -167,7 +167,7 @@ TEST(PayloadRouterTest, SendOnOneModule) {
|
|||||||
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
|
test.router()->OnEncodedImage(encoded_image, nullptr, nullptr).error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PayloadRouterTest, SendSimulcastSetActive) {
|
TEST(RtpVideoSenderTest, SendSimulcastSetActive) {
|
||||||
uint8_t payload = 'a';
|
uint8_t payload = 'a';
|
||||||
EncodedImage encoded_image;
|
EncodedImage encoded_image;
|
||||||
encoded_image._timeStamp = 1;
|
encoded_image._timeStamp = 1;
|
||||||
@ -176,7 +176,7 @@ TEST(PayloadRouterTest, SendSimulcastSetActive) {
|
|||||||
encoded_image._buffer = &payload;
|
encoded_image._buffer = &payload;
|
||||||
encoded_image._length = 1;
|
encoded_image._length = 1;
|
||||||
|
|
||||||
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
||||||
|
|
||||||
CodecSpecificInfo codec_info_1;
|
CodecSpecificInfo codec_info_1;
|
||||||
memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
|
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
|
// 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
|
// that outgoing data can be sent on this module, and checks that no data can
|
||||||
// be sent if both modules are inactive.
|
// be sent if both modules are inactive.
|
||||||
TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
|
TEST(RtpVideoSenderTest, SendSimulcastSetActiveModules) {
|
||||||
uint8_t payload = 'a';
|
uint8_t payload = 'a';
|
||||||
EncodedImage encoded_image;
|
EncodedImage encoded_image;
|
||||||
encoded_image._timeStamp = 1;
|
encoded_image._timeStamp = 1;
|
||||||
@ -223,7 +223,7 @@ TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
|
|||||||
encoded_image._buffer = &payload;
|
encoded_image._buffer = &payload;
|
||||||
encoded_image._length = 1;
|
encoded_image._length = 1;
|
||||||
|
|
||||||
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
||||||
CodecSpecificInfo codec_info_1;
|
CodecSpecificInfo codec_info_1;
|
||||||
memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
|
memset(&codec_info_1, 0, sizeof(CodecSpecificInfo));
|
||||||
codec_info_1.codecType = kVideoCodecVP8;
|
codec_info_1.codecType = kVideoCodecVP8;
|
||||||
@ -258,8 +258,8 @@ TEST(PayloadRouterTest, SendSimulcastSetActiveModules) {
|
|||||||
.error);
|
.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PayloadRouterTest, CreateWithNoPreviousStates) {
|
TEST(RtpVideoSenderTest, CreateWithNoPreviousStates) {
|
||||||
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, {});
|
||||||
test.router()->SetActive(true);
|
test.router()->SetActive(true);
|
||||||
|
|
||||||
std::map<uint32_t, RtpPayloadState> initial_states =
|
std::map<uint32_t, RtpPayloadState> initial_states =
|
||||||
@ -269,7 +269,7 @@ TEST(PayloadRouterTest, CreateWithNoPreviousStates) {
|
|||||||
EXPECT_NE(initial_states.find(kSsrc2), initial_states.end());
|
EXPECT_NE(initial_states.find(kSsrc2), initial_states.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(PayloadRouterTest, CreateWithPreviousStates) {
|
TEST(RtpVideoSenderTest, CreateWithPreviousStates) {
|
||||||
RtpPayloadState state1;
|
RtpPayloadState state1;
|
||||||
state1.picture_id = kInitialPictureId1;
|
state1.picture_id = kInitialPictureId1;
|
||||||
state1.tl0_pic_idx = kInitialTl0PicIdx1;
|
state1.tl0_pic_idx = kInitialTl0PicIdx1;
|
||||||
@ -279,7 +279,7 @@ TEST(PayloadRouterTest, CreateWithPreviousStates) {
|
|||||||
std::map<uint32_t, RtpPayloadState> states = {{kSsrc1, state1},
|
std::map<uint32_t, RtpPayloadState> states = {{kSsrc1, state1},
|
||||||
{kSsrc2, state2}};
|
{kSsrc2, state2}};
|
||||||
|
|
||||||
PayloadRouterTestFixture test({kSsrc1, kSsrc2}, kPayloadType, states);
|
RtpVideoSenderTestFixture test({kSsrc1, kSsrc2}, kPayloadType, states);
|
||||||
test.router()->SetActive(true);
|
test.router()->SetActive(true);
|
||||||
|
|
||||||
std::map<uint32_t, RtpPayloadState> initial_states =
|
std::map<uint32_t, RtpPayloadState> initial_states =
|
@ -30,8 +30,8 @@ class MockRtpTransportControllerSend
|
|||||||
: public RtpTransportControllerSendInterface {
|
: public RtpTransportControllerSendInterface {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD8(
|
MOCK_METHOD8(
|
||||||
CreateVideoRtpSender,
|
CreateRtpVideoSender,
|
||||||
VideoRtpSenderInterface*(const std::vector<uint32_t>&,
|
RtpVideoSenderInterface*(const std::vector<uint32_t>&,
|
||||||
std::map<uint32_t, RtpState>,
|
std::map<uint32_t, RtpState>,
|
||||||
const std::map<uint32_t, RtpPayloadState>&,
|
const std::map<uint32_t, RtpPayloadState>&,
|
||||||
const RtpConfig&,
|
const RtpConfig&,
|
||||||
@ -39,7 +39,7 @@ class MockRtpTransportControllerSend
|
|||||||
Transport*,
|
Transport*,
|
||||||
const RtpSenderObservers&,
|
const RtpSenderObservers&,
|
||||||
RtcEventLog*));
|
RtcEventLog*));
|
||||||
MOCK_METHOD1(DestroyVideoRtpSender, void(VideoRtpSenderInterface*));
|
MOCK_METHOD1(DestroyRtpVideoSender, void(RtpVideoSenderInterface*));
|
||||||
MOCK_METHOD0(GetWorkerQueue, rtc::TaskQueue*());
|
MOCK_METHOD0(GetWorkerQueue, rtc::TaskQueue*());
|
||||||
MOCK_METHOD0(packet_router, PacketRouter*());
|
MOCK_METHOD0(packet_router, PacketRouter*());
|
||||||
MOCK_METHOD0(transport_feedback_observer, TransportFeedbackObserver*());
|
MOCK_METHOD0(transport_feedback_observer, TransportFeedbackObserver*());
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/call/transport.h"
|
#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_sink_interface.h"
|
||||||
#include "api/video/video_source_interface.h"
|
#include "api/video/video_source_interface.h"
|
||||||
#include "api/video_codecs/video_encoder_config.h"
|
#include "api/video_codecs/video_encoder_config.h"
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "api/fec_controller.h"
|
#include "api/fec_controller.h"
|
||||||
#include "call/bitrate_allocator.h"
|
#include "call/bitrate_allocator.h"
|
||||||
#include "call/payload_router.h"
|
|
||||||
#include "call/video_receive_stream.h"
|
#include "call/video_receive_stream.h"
|
||||||
#include "call/video_send_stream.h"
|
#include "call/video_send_stream.h"
|
||||||
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
||||||
|
@ -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) /
|
return static_cast<int>((bitrate_bps + packet_size_bits - 1) /
|
||||||
packet_size_bits);
|
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,
|
RtpSenderObservers CreateObservers(CallStats* call_stats,
|
||||||
EncoderRtcpFeedback* encoder_feedback,
|
EncoderRtcpFeedback* encoder_feedback,
|
||||||
SendStatisticsProxy* stats_proxy,
|
SendStatisticsProxy* stats_proxy,
|
||||||
@ -229,8 +220,8 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
|||||||
config_->rtp.ssrcs,
|
config_->rtp.ssrcs,
|
||||||
video_stream_encoder),
|
video_stream_encoder),
|
||||||
bandwidth_observer_(transport->GetBandwidthObserver()),
|
bandwidth_observer_(transport->GetBandwidthObserver()),
|
||||||
payload_router_(
|
rtp_video_sender_(
|
||||||
transport_->CreateVideoRtpSender(config_->rtp.ssrcs,
|
transport_->CreateRtpVideoSender(config_->rtp.ssrcs,
|
||||||
suspended_ssrcs,
|
suspended_ssrcs,
|
||||||
suspended_payload_states,
|
suspended_payload_states,
|
||||||
config_->rtp,
|
config_->rtp,
|
||||||
@ -304,8 +295,8 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
|||||||
|
|
||||||
// Currently, both ULPFEC and FlexFEC use the same FEC rate calculation logic,
|
// Currently, both ULPFEC and FlexFEC use the same FEC rate calculation logic,
|
||||||
// so enable that logic if either of those FEC schemes are enabled.
|
// so enable that logic if either of those FEC schemes are enabled.
|
||||||
fec_controller_->SetProtectionMethod(payload_router_->FecEnabled(),
|
fec_controller_->SetProtectionMethod(rtp_video_sender_->FecEnabled(),
|
||||||
payload_router_->NackEnabled());
|
rtp_video_sender_->NackEnabled());
|
||||||
|
|
||||||
fec_controller_->SetProtectionCallback(this);
|
fec_controller_->SetProtectionCallback(this);
|
||||||
// Signal congestion controller this object is ready for OnPacket* callbacks.
|
// Signal congestion controller this object is ready for OnPacket* callbacks.
|
||||||
@ -335,28 +326,28 @@ VideoSendStreamImpl::VideoSendStreamImpl(
|
|||||||
|
|
||||||
VideoSendStreamImpl::~VideoSendStreamImpl() {
|
VideoSendStreamImpl::~VideoSendStreamImpl() {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
RTC_DCHECK(!payload_router_->IsActive())
|
RTC_DCHECK(!rtp_video_sender_->IsActive())
|
||||||
<< "VideoSendStreamImpl::Stop not called";
|
<< "VideoSendStreamImpl::Stop not called";
|
||||||
RTC_LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString();
|
RTC_LOG(LS_INFO) << "~VideoSendStreamInternal: " << config_->ToString();
|
||||||
if (fec_controller_->UseLossVectorMask()) {
|
if (fec_controller_->UseLossVectorMask()) {
|
||||||
transport_->DeRegisterPacketFeedbackObserver(this);
|
transport_->DeRegisterPacketFeedbackObserver(this);
|
||||||
}
|
}
|
||||||
transport_->DestroyVideoRtpSender(payload_router_);
|
transport_->DestroyRtpVideoSender(rtp_video_sender_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSendStreamImpl::RegisterProcessThread(
|
void VideoSendStreamImpl::RegisterProcessThread(
|
||||||
ProcessThread* module_process_thread) {
|
ProcessThread* module_process_thread) {
|
||||||
payload_router_->RegisterProcessThread(module_process_thread);
|
rtp_video_sender_->RegisterProcessThread(module_process_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSendStreamImpl::DeRegisterProcessThread() {
|
void VideoSendStreamImpl::DeRegisterProcessThread() {
|
||||||
payload_router_->DeRegisterProcessThread();
|
rtp_video_sender_->DeRegisterProcessThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) {
|
bool VideoSendStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) {
|
||||||
// Runs on a network thread.
|
// Runs on a network thread.
|
||||||
RTC_DCHECK(!worker_queue_->IsCurrent());
|
RTC_DCHECK(!worker_queue_->IsCurrent());
|
||||||
payload_router_->DeliverRtcp(packet, length);
|
rtp_video_sender_->DeliverRtcp(packet, length);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,12 +355,12 @@ void VideoSendStreamImpl::UpdateActiveSimulcastLayers(
|
|||||||
const std::vector<bool> active_layers) {
|
const std::vector<bool> active_layers) {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
RTC_LOG(LS_INFO) << "VideoSendStream::UpdateActiveSimulcastLayers";
|
RTC_LOG(LS_INFO) << "VideoSendStream::UpdateActiveSimulcastLayers";
|
||||||
bool previously_active = payload_router_->IsActive();
|
bool previously_active = rtp_video_sender_->IsActive();
|
||||||
payload_router_->SetActiveModules(active_layers);
|
rtp_video_sender_->SetActiveModules(active_layers);
|
||||||
if (!payload_router_->IsActive() && previously_active) {
|
if (!rtp_video_sender_->IsActive() && previously_active) {
|
||||||
// Payload router switched from active to inactive.
|
// Payload router switched from active to inactive.
|
||||||
StopVideoSendStream();
|
StopVideoSendStream();
|
||||||
} else if (payload_router_->IsActive() && !previously_active) {
|
} else if (rtp_video_sender_->IsActive() && !previously_active) {
|
||||||
// Payload router switched from inactive to active.
|
// Payload router switched from inactive to active.
|
||||||
StartupVideoSendStream();
|
StartupVideoSendStream();
|
||||||
}
|
}
|
||||||
@ -378,10 +369,10 @@ void VideoSendStreamImpl::UpdateActiveSimulcastLayers(
|
|||||||
void VideoSendStreamImpl::Start() {
|
void VideoSendStreamImpl::Start() {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
RTC_LOG(LS_INFO) << "VideoSendStream::Start";
|
RTC_LOG(LS_INFO) << "VideoSendStream::Start";
|
||||||
if (payload_router_->IsActive())
|
if (rtp_video_sender_->IsActive())
|
||||||
return;
|
return;
|
||||||
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start");
|
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Start");
|
||||||
payload_router_->SetActive(true);
|
rtp_video_sender_->SetActive(true);
|
||||||
StartupVideoSendStream();
|
StartupVideoSendStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,10 +401,10 @@ void VideoSendStreamImpl::StartupVideoSendStream() {
|
|||||||
void VideoSendStreamImpl::Stop() {
|
void VideoSendStreamImpl::Stop() {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
RTC_LOG(LS_INFO) << "VideoSendStream::Stop";
|
RTC_LOG(LS_INFO) << "VideoSendStream::Stop";
|
||||||
if (!payload_router_->IsActive())
|
if (!rtp_video_sender_->IsActive())
|
||||||
return;
|
return;
|
||||||
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop");
|
TRACE_EVENT_INSTANT0("webrtc", "VideoSendStream::Stop");
|
||||||
payload_router_->SetActive(false);
|
rtp_video_sender_->SetActive(false);
|
||||||
StopVideoSendStream();
|
StopVideoSendStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +432,7 @@ void VideoSendStreamImpl::SignalEncoderTimedOut() {
|
|||||||
|
|
||||||
void VideoSendStreamImpl::OnBitrateAllocationUpdated(
|
void VideoSendStreamImpl::OnBitrateAllocationUpdated(
|
||||||
const VideoBitrateAllocation& allocation) {
|
const VideoBitrateAllocation& allocation) {
|
||||||
payload_router_->OnBitrateAllocationUpdated(allocation);
|
rtp_video_sender_->OnBitrateAllocationUpdated(allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSendStreamImpl::SignalEncoderActive() {
|
void VideoSendStreamImpl::SignalEncoderActive() {
|
||||||
@ -511,7 +502,7 @@ void VideoSendStreamImpl::OnEncoderConfigurationChanged(
|
|||||||
num_temporal_layers,
|
num_temporal_layers,
|
||||||
config_->rtp.max_packet_size);
|
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
|
// The send stream is started already. Update the allocator with new bitrate
|
||||||
// limits.
|
// limits.
|
||||||
bitrate_allocator_->AddObserver(
|
bitrate_allocator_->AddObserver(
|
||||||
@ -548,7 +539,7 @@ EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage(
|
|||||||
|
|
||||||
fec_controller_->UpdateWithEncodedData(encoded_image._length,
|
fec_controller_->UpdateWithEncodedData(encoded_image._length,
|
||||||
encoded_image._frameType);
|
encoded_image._frameType);
|
||||||
EncodedImageCallback::Result result = payload_router_->OnEncodedImage(
|
EncodedImageCallback::Result result = rtp_video_sender_->OnEncodedImage(
|
||||||
encoded_image, codec_specific_info, fragmentation);
|
encoded_image, codec_specific_info, fragmentation);
|
||||||
|
|
||||||
RTC_DCHECK(codec_specific_info);
|
RTC_DCHECK(codec_specific_info);
|
||||||
@ -569,12 +560,12 @@ EncodedImageCallback::Result VideoSendStreamImpl::OnEncodedImage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, RtpState> VideoSendStreamImpl::GetRtpStates() const {
|
std::map<uint32_t, RtpState> VideoSendStreamImpl::GetRtpStates() const {
|
||||||
return payload_router_->GetRtpStates();
|
return rtp_video_sender_->GetRtpStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, RtpPayloadState> VideoSendStreamImpl::GetRtpPayloadStates()
|
std::map<uint32_t, RtpPayloadState> VideoSendStreamImpl::GetRtpPayloadStates()
|
||||||
const {
|
const {
|
||||||
return payload_router_->GetRtpPayloadStates();
|
return rtp_video_sender_->GetRtpPayloadStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t VideoSendStreamImpl::OnBitrateUpdated(uint32_t bitrate_bps,
|
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 rtt,
|
||||||
int64_t probing_interval_ms) {
|
int64_t probing_interval_ms) {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
RTC_DCHECK(payload_router_->IsActive())
|
RTC_DCHECK(rtp_video_sender_->IsActive())
|
||||||
<< "VideoSendStream::Start has not been called.";
|
<< "VideoSendStream::Start has not been called.";
|
||||||
|
|
||||||
// Substract overhead from bitrate.
|
// Substract overhead from bitrate.
|
||||||
@ -657,7 +648,7 @@ int VideoSendStreamImpl::ProtectionRequest(
|
|||||||
uint32_t* sent_nack_rate_bps,
|
uint32_t* sent_nack_rate_bps,
|
||||||
uint32_t* sent_fec_rate_bps) {
|
uint32_t* sent_fec_rate_bps) {
|
||||||
RTC_DCHECK_RUN_ON(worker_queue_);
|
RTC_DCHECK_RUN_ON(worker_queue_);
|
||||||
payload_router_->ProtectionRequest(delta_params, key_params,
|
rtp_video_sender_->ProtectionRequest(delta_params, key_params,
|
||||||
sent_video_rate_bps, sent_nack_rate_bps,
|
sent_video_rate_bps, sent_nack_rate_bps,
|
||||||
sent_fec_rate_bps);
|
sent_fec_rate_bps);
|
||||||
return 0;
|
return 0;
|
||||||
@ -681,7 +672,7 @@ void VideoSendStreamImpl::SetTransportOverhead(
|
|||||||
std::min(config_->rtp.max_packet_size,
|
std::min(config_->rtp.max_packet_size,
|
||||||
kPathMTU - transport_overhead_bytes_per_packet_);
|
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) {
|
void VideoSendStreamImpl::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "call/bitrate_allocator.h"
|
#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_types.h" // NOLINT(build/include)
|
||||||
#include "common_video/include/video_bitrate_allocator.h"
|
#include "common_video/include/video_bitrate_allocator.h"
|
||||||
#include "modules/utility/include/process_thread.h"
|
#include "modules/utility/include/process_thread.h"
|
||||||
@ -170,7 +170,7 @@ class VideoSendStreamImpl : public webrtc::BitrateAllocatorObserver,
|
|||||||
EncoderRtcpFeedback encoder_feedback_;
|
EncoderRtcpFeedback encoder_feedback_;
|
||||||
|
|
||||||
RtcpBandwidthObserver* const bandwidth_observer_;
|
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_| to our self. This is used since we can not call
|
||||||
// |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy
|
// |weak_ptr_factory_.GetWeakPtr| from multiple sequences but it is ok to copy
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "call/payload_router.h"
|
#include "call/rtp_video_sender.h"
|
||||||
#include "call/test/mock_bitrate_allocator.h"
|
#include "call/test/mock_bitrate_allocator.h"
|
||||||
#include "call/test/mock_rtp_transport_controller_send.h"
|
#include "call/test/mock_rtp_transport_controller_send.h"
|
||||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||||
@ -44,7 +44,7 @@ std::string GetAlrProbingExperimentString() {
|
|||||||
AlrExperimentSettings::kScreenshareProbingBweExperimentName) +
|
AlrExperimentSettings::kScreenshareProbingBweExperimentName) +
|
||||||
"/1.0,2875,80,40,-60,3/";
|
"/1.0,2875,80,40,-60,3/";
|
||||||
}
|
}
|
||||||
class MockPayloadRouter : public VideoRtpSenderInterface {
|
class MockPayloadRouter : public RtpVideoSenderInterface {
|
||||||
public:
|
public:
|
||||||
MOCK_METHOD1(RegisterProcessThread, void(ProcessThread*));
|
MOCK_METHOD1(RegisterProcessThread, void(ProcessThread*));
|
||||||
MOCK_METHOD0(DeRegisterProcessThread, void());
|
MOCK_METHOD0(DeRegisterProcessThread, void());
|
||||||
@ -93,7 +93,7 @@ class VideoSendStreamImplTest : public ::testing::Test {
|
|||||||
EXPECT_CALL(transport_controller_, packet_router())
|
EXPECT_CALL(transport_controller_, packet_router())
|
||||||
.WillRepeatedly(Return(&packet_router_));
|
.WillRepeatedly(Return(&packet_router_));
|
||||||
EXPECT_CALL(transport_controller_,
|
EXPECT_CALL(transport_controller_,
|
||||||
CreateVideoRtpSender(_, _, _, _, _, _, _, _))
|
CreateRtpVideoSender(_, _, _, _, _, _, _, _))
|
||||||
.WillRepeatedly(Return(&payload_router_));
|
.WillRepeatedly(Return(&payload_router_));
|
||||||
EXPECT_CALL(payload_router_, SetActive(_))
|
EXPECT_CALL(payload_router_, SetActive(_))
|
||||||
.WillRepeatedly(testing::Invoke(
|
.WillRepeatedly(testing::Invoke(
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "call/payload_router.h"
|
|
||||||
#include "modules/video_coding/video_coding_impl.h"
|
#include "modules/video_coding/video_coding_impl.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
|
Reference in New Issue
Block a user