Pass Environment into RtcpSender
To remove usage of RtcpConfiguration fields that are passed through Environment Bug: webrtc:362762208 Change-Id: I1a0f218efe6a893c31ef2272cf2379c66fb7b205 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361746 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42984}
This commit is contained in:
parent
363dc19f9d
commit
0acbb7745f
@ -22,6 +22,7 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/units/data_rate.h"
|
||||
@ -137,10 +138,8 @@ RTCPSender::Configuration RTCPSender::Configuration::FromRtpRtcpConfiguration(
|
||||
RTCPSender::Configuration result;
|
||||
result.audio = configuration.audio;
|
||||
result.local_media_ssrc = configuration.local_media_ssrc;
|
||||
result.clock = configuration.clock;
|
||||
result.outgoing_transport = configuration.outgoing_transport;
|
||||
result.non_sender_rtt_measurement = configuration.non_sender_rtt_measurement;
|
||||
result.event_log = configuration.event_log;
|
||||
if (configuration.rtcp_report_interval_ms) {
|
||||
result.rtcp_report_interval =
|
||||
TimeDelta::Millis(configuration.rtcp_report_interval_ms);
|
||||
@ -151,13 +150,12 @@ RTCPSender::Configuration RTCPSender::Configuration::FromRtpRtcpConfiguration(
|
||||
return result;
|
||||
}
|
||||
|
||||
RTCPSender::RTCPSender(Configuration config)
|
||||
: audio_(config.audio),
|
||||
RTCPSender::RTCPSender(const Environment& env, Configuration config)
|
||||
: env_(env),
|
||||
audio_(config.audio),
|
||||
ssrc_(config.local_media_ssrc),
|
||||
clock_(config.clock),
|
||||
random_(clock_->TimeInMicroseconds()),
|
||||
random_(env_.clock().TimeInMicroseconds()),
|
||||
method_(RtcpMode::kOff),
|
||||
event_log_(config.event_log),
|
||||
transport_(config.outgoing_transport),
|
||||
report_interval_(config.rtcp_report_interval.value_or(
|
||||
TimeDelta::Millis(config.audio ? kDefaultAudioReportInterval
|
||||
@ -243,9 +241,7 @@ int32_t RTCPSender::SendLossNotification(const FeedbackState& feedback_state,
|
||||
auto callback = [&](rtc::ArrayView<const uint8_t> packet) {
|
||||
transport_->SendRtcp(packet);
|
||||
error_code = 0;
|
||||
if (event_log_) {
|
||||
event_log_->Log(std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
env_.event_log().Log(std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
};
|
||||
std::optional<PacketSender> sender;
|
||||
{
|
||||
@ -326,7 +322,7 @@ void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
||||
last_rtp_timestamp_ = rtp_timestamp;
|
||||
if (!capture_time.has_value()) {
|
||||
// We don't currently get a capture time from VoiceEngine.
|
||||
last_frame_capture_time_ = clock_->CurrentTime();
|
||||
last_frame_capture_time_ = env_.clock().CurrentTime();
|
||||
} else {
|
||||
last_frame_capture_time_ = *capture_time;
|
||||
}
|
||||
@ -360,7 +356,7 @@ int32_t RTCPSender::SetCNAME(absl::string_view c_name) {
|
||||
}
|
||||
|
||||
bool RTCPSender::TimeToSendRTCPReport(bool send_keyframe_before_rtp) const {
|
||||
Timestamp now = clock_->CurrentTime();
|
||||
Timestamp now = env_.clock().CurrentTime();
|
||||
|
||||
MutexLock lock(&mutex_rtcp_sender_);
|
||||
RTC_DCHECK(
|
||||
@ -400,7 +396,7 @@ void RTCPSender::BuildSR(const RtcpContext& ctx, PacketSender& sender) {
|
||||
|
||||
rtcp::SenderReport report;
|
||||
report.SetSenderSsrc(ssrc_);
|
||||
report.SetNtp(clock_->ConvertTimestampToNtpTime(ctx.now_));
|
||||
report.SetNtp(env_.clock().ConvertTimestampToNtpTime(ctx.now_));
|
||||
report.SetRtpTimestamp(rtp_timestamp);
|
||||
report.SetPacketCount(ctx.feedback_state_.packets_sent);
|
||||
report.SetOctetCount(ctx.feedback_state_.media_bytes_sent);
|
||||
@ -568,7 +564,7 @@ void RTCPSender::BuildExtendedReports(const RtcpContext& ctx,
|
||||
|
||||
if (!sending_ && xr_send_receiver_reference_time_enabled_) {
|
||||
rtcp::Rrtr rrtr;
|
||||
rrtr.SetNtp(clock_->ConvertTimestampToNtpTime(ctx.now_));
|
||||
rrtr.SetNtp(env_.clock().ConvertTimestampToNtpTime(ctx.now_));
|
||||
xr.SetRrtr(rrtr);
|
||||
}
|
||||
|
||||
@ -602,9 +598,8 @@ int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state,
|
||||
auto callback = [&](rtc::ArrayView<const uint8_t> packet) {
|
||||
if (transport_->SendRtcp(packet)) {
|
||||
error_code = 0;
|
||||
if (event_log_) {
|
||||
event_log_->Log(std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
env_.event_log().Log(
|
||||
std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
};
|
||||
std::optional<PacketSender> sender;
|
||||
@ -654,7 +649,7 @@ std::optional<int32_t> RTCPSender::ComputeCompoundRTCPPacket(
|
||||
|
||||
// We need to send our NTP even if we haven't received any reports.
|
||||
RtcpContext context(feedback_state, nack_size, nack_list,
|
||||
clock_->CurrentTime());
|
||||
env_.clock().CurrentTime());
|
||||
|
||||
PrepareReport(feedback_state);
|
||||
|
||||
@ -781,7 +776,7 @@ std::vector<rtcp::ReportBlock> RTCPSender::CreateReportBlocks(
|
||||
|
||||
if (!result.empty() && feedback_state.last_rr.Valid()) {
|
||||
// Get our NTP as late as possible to avoid a race.
|
||||
uint32_t now = CompactNtp(clock_->CurrentNtpTime());
|
||||
uint32_t now = CompactNtp(env_.clock().CurrentNtpTime());
|
||||
uint32_t receive_time = CompactNtp(feedback_state.last_rr);
|
||||
uint32_t delay_since_last_sr = now - receive_time;
|
||||
|
||||
@ -900,8 +895,8 @@ void RTCPSender::SendCombinedRtcpPacket(
|
||||
RTC_DCHECK_LE(max_packet_size, IP_PACKET_SIZE);
|
||||
auto callback = [&](rtc::ArrayView<const uint8_t> packet) {
|
||||
if (transport_->SendRtcp(packet)) {
|
||||
if (event_log_)
|
||||
event_log_->Log(std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
env_.event_log().Log(
|
||||
std::make_unique<RtcEventRtcpPacketOutgoing>(packet));
|
||||
}
|
||||
};
|
||||
PacketSender sender(callback, max_packet_size);
|
||||
@ -913,7 +908,7 @@ void RTCPSender::SendCombinedRtcpPacket(
|
||||
}
|
||||
|
||||
void RTCPSender::SetNextRtcpSendEvaluationDuration(TimeDelta duration) {
|
||||
next_time_to_send_rtcp_ = clock_->CurrentTime() + duration;
|
||||
next_time_to_send_rtcp_ = env_.clock().CurrentTime() + duration;
|
||||
// TODO(bugs.webrtc.org/11581): make unconditional once downstream consumers
|
||||
// are using the callback method.
|
||||
if (schedule_next_rtcp_send_evaluation_function_)
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/time_delta.h"
|
||||
@ -46,7 +47,6 @@
|
||||
namespace webrtc {
|
||||
|
||||
class RTCPReceiver;
|
||||
class RtcEventLog;
|
||||
|
||||
class RTCPSender final {
|
||||
public:
|
||||
@ -62,8 +62,7 @@ class RTCPSender final {
|
||||
// SSRCs for media and retransmission, respectively.
|
||||
// FlexFec SSRC is fetched from `flexfec_sender`.
|
||||
uint32_t local_media_ssrc = 0;
|
||||
// The clock to use to read time. If nullptr then system clock will be used.
|
||||
Clock* clock = nullptr;
|
||||
|
||||
// Transport object that will be called when packets are ready to be sent
|
||||
// out on the network.
|
||||
Transport* outgoing_transport = nullptr;
|
||||
@ -82,7 +81,6 @@ class RTCPSender final {
|
||||
// have migrated to the callback solution.
|
||||
std::function<void(TimeDelta)> schedule_next_rtcp_send_evaluation_function;
|
||||
|
||||
RtcEventLog* event_log = nullptr;
|
||||
std::optional<TimeDelta> rtcp_report_interval;
|
||||
ReceiveStatisticsProvider* receive_statistics = nullptr;
|
||||
RtcpPacketTypeCounterObserver* rtcp_packet_type_counter_observer = nullptr;
|
||||
@ -107,13 +105,13 @@ class RTCPSender final {
|
||||
RTCPReceiver* receiver;
|
||||
};
|
||||
|
||||
explicit RTCPSender(Configuration config);
|
||||
RTCPSender(const Environment& env, Configuration config);
|
||||
|
||||
RTCPSender() = delete;
|
||||
RTCPSender(const RTCPSender&) = delete;
|
||||
RTCPSender& operator=(const RTCPSender&) = delete;
|
||||
|
||||
virtual ~RTCPSender();
|
||||
~RTCPSender();
|
||||
|
||||
RtcpMode Status() const RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||
void SetRTCPStatus(RtcpMode method) RTC_LOCKS_EXCLUDED(mutex_rtcp_sender_);
|
||||
@ -238,17 +236,16 @@ class RTCPSender final {
|
||||
void SetNextRtcpSendEvaluationDuration(TimeDelta duration)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_rtcp_sender_);
|
||||
|
||||
const Environment env_;
|
||||
const bool audio_;
|
||||
// TODO(bugs.webrtc.org/11581): `mutex_rtcp_sender_` shouldn't be required if
|
||||
// we consistently run network related operations on the network thread.
|
||||
// This is currently not possible due to callbacks from the process thread in
|
||||
// ModuleRtpRtcpImpl2.
|
||||
uint32_t ssrc_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||
Clock* const clock_;
|
||||
Random random_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||
RtcpMode method_ RTC_GUARDED_BY(mutex_rtcp_sender_);
|
||||
|
||||
RtcEventLog* const event_log_;
|
||||
Transport* const transport_;
|
||||
|
||||
const TimeDelta report_interval_;
|
||||
|
||||
@ -10,20 +10,40 @@
|
||||
|
||||
#include "modules/rtp_rtcp/source/rtcp_sender.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/macros.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/environment/environment_factory.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "modules/rtp_rtcp/include/receive_statistics.h"
|
||||
#include "modules/rtp_rtcp/include/rtcp_statistics.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/remote_estimate.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
||||
#include "rtc_base/rate_limiter.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/ntp_time.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_transport.h"
|
||||
@ -72,19 +92,6 @@ static const uint32_t kSenderSsrc = 0x11111111;
|
||||
static const uint32_t kRemoteSsrc = 0x22222222;
|
||||
static const uint32_t kStartRtpTimestamp = 0x34567;
|
||||
static const uint32_t kRtpTimestamp = 0x45678;
|
||||
|
||||
std::unique_ptr<RTCPSender> CreateRtcpSender(
|
||||
const RTCPSender::Configuration& config,
|
||||
bool init_timestamps = true) {
|
||||
auto rtcp_sender = std::make_unique<RTCPSender>(config);
|
||||
rtcp_sender->SetRemoteSSRC(kRemoteSsrc);
|
||||
if (init_timestamps) {
|
||||
rtcp_sender->SetTimestampOffset(kStartRtpTimestamp);
|
||||
rtcp_sender->SetLastRtpTime(kRtpTimestamp, config.clock->CurrentTime(),
|
||||
/*payload_type=*/0);
|
||||
}
|
||||
return rtcp_sender;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class RtcpSenderTest : public ::testing::Test {
|
||||
@ -98,7 +105,6 @@ class RtcpSenderTest : public ::testing::Test {
|
||||
RTCPSender::Configuration GetDefaultConfig() {
|
||||
RTCPSender::Configuration configuration;
|
||||
configuration.audio = false;
|
||||
configuration.clock = &clock_;
|
||||
configuration.outgoing_transport = &test_transport_;
|
||||
configuration.rtcp_report_interval = TimeDelta::Millis(1000);
|
||||
configuration.receive_statistics = receive_statistics_.get();
|
||||
@ -117,6 +123,19 @@ class RtcpSenderTest : public ::testing::Test {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<RTCPSender> CreateRtcpSender(
|
||||
const RTCPSender::Configuration& config,
|
||||
bool init_timestamps = true) {
|
||||
auto rtcp_sender = std::make_unique<RTCPSender>(env_, config);
|
||||
rtcp_sender->SetRemoteSSRC(kRemoteSsrc);
|
||||
if (init_timestamps) {
|
||||
rtcp_sender->SetTimestampOffset(kStartRtpTimestamp);
|
||||
rtcp_sender->SetLastRtpTime(kRtpTimestamp, env_.clock().CurrentTime(),
|
||||
/*payload_type=*/0);
|
||||
}
|
||||
return rtcp_sender;
|
||||
}
|
||||
|
||||
void InsertIncomingPacket(uint32_t remote_ssrc, uint16_t seq_num) {
|
||||
RtpPacketReceived packet;
|
||||
packet.SetSsrc(remote_ssrc);
|
||||
@ -217,7 +236,6 @@ TEST_F(RtcpSenderTest, SendConsecutiveSrWithExactSlope) {
|
||||
|
||||
TEST_F(RtcpSenderTest, DoNotSendSrBeforeRtp) {
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = &clock_;
|
||||
config.receive_statistics = receive_statistics_.get();
|
||||
config.outgoing_transport = &test_transport_;
|
||||
config.rtcp_report_interval = TimeDelta::Millis(1000);
|
||||
@ -238,7 +256,6 @@ TEST_F(RtcpSenderTest, DoNotSendSrBeforeRtp) {
|
||||
|
||||
TEST_F(RtcpSenderTest, DoNotSendCompundBeforeRtp) {
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = &clock_;
|
||||
config.receive_statistics = receive_statistics_.get();
|
||||
config.outgoing_transport = &test_transport_;
|
||||
config.rtcp_report_interval = TimeDelta::Millis(1000);
|
||||
@ -592,7 +609,6 @@ TEST_F(RtcpSenderTest, TestNoXrRrtrSentIfNotEnabled) {
|
||||
TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) {
|
||||
RtcpPacketTypeCounterObserverImpl observer;
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = &clock_;
|
||||
config.receive_statistics = receive_statistics_.get();
|
||||
config.outgoing_transport = &test_transport_;
|
||||
config.rtcp_packet_type_counter_observer = &observer;
|
||||
@ -687,7 +703,6 @@ TEST_F(RtcpSenderTest, ByeMustBeLast) {
|
||||
|
||||
// Re-configure rtcp_sender with mock_transport_
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = &clock_;
|
||||
config.receive_statistics = receive_statistics_.get();
|
||||
config.outgoing_transport = &mock_transport;
|
||||
config.rtcp_report_interval = TimeDelta::Millis(1000);
|
||||
|
||||
@ -89,6 +89,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Environment& env,
|
||||
const Configuration& configuration)
|
||||
: env_(env),
|
||||
rtcp_sender_(
|
||||
env_,
|
||||
RTCPSender::Configuration::FromRtpRtcpConfiguration(configuration)),
|
||||
rtcp_receiver_(env_, configuration, this),
|
||||
last_bitrate_process_time_(env_.clock().TimeInMilliseconds()),
|
||||
|
||||
@ -111,11 +111,13 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(TagConfigurationIncludesEnvironment,
|
||||
const Configuration& configuration)
|
||||
: env_(env),
|
||||
worker_queue_(TaskQueueBase::Current()),
|
||||
rtcp_sender_(AddRtcpSendEvaluationCallback(
|
||||
RTCPSender::Configuration::FromRtpRtcpConfiguration(configuration),
|
||||
[this](TimeDelta duration) {
|
||||
ScheduleRtcpSendEvaluation(duration);
|
||||
})),
|
||||
rtcp_sender_(env_,
|
||||
AddRtcpSendEvaluationCallback(
|
||||
RTCPSender::Configuration::FromRtpRtcpConfiguration(
|
||||
configuration),
|
||||
[this](TimeDelta duration) {
|
||||
ScheduleRtcpSendEvaluation(duration);
|
||||
})),
|
||||
rtcp_receiver_(env_, configuration, this),
|
||||
packet_overhead_(28), // IPV4 UDP.
|
||||
nack_last_time_sent_full_ms_(0),
|
||||
|
||||
@ -806,15 +806,15 @@ if (rtc_include_tests) {
|
||||
":video_stream_buffer_controller",
|
||||
":video_stream_encoder_impl",
|
||||
":video_stream_encoder_interface",
|
||||
"..//test/network:simulated_network",
|
||||
"../api:array_view",
|
||||
"../api:bitrate_allocation",
|
||||
"../api:create_frame_generator",
|
||||
"../api:fake_frame_decryptor",
|
||||
"../api:fake_frame_encryptor",
|
||||
"../api:fec_controller_api",
|
||||
"../api:field_trials_view",
|
||||
"../api:frame_generator_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:make_ref_counted",
|
||||
"../api:mock_fec_controller_override",
|
||||
"../api:mock_frame_decryptor",
|
||||
"../api:mock_frame_transformer",
|
||||
@ -827,9 +827,6 @@ if (rtc_include_tests) {
|
||||
"../api:sequence_checker",
|
||||
"../api:simulated_network_api",
|
||||
"../api:time_controller",
|
||||
"../api:transport_api",
|
||||
"../api/adaptation:resource_adaptation_api",
|
||||
"../api/adaptation:resource_adaptation_api",
|
||||
"../api/crypto:options",
|
||||
"../api/environment",
|
||||
"../api/environment:environment_factory",
|
||||
@ -837,9 +834,11 @@ if (rtc_include_tests) {
|
||||
"../api/rtc_event_log",
|
||||
"../api/task_queue",
|
||||
"../api/task_queue:default_task_queue_factory",
|
||||
"../api/task_queue:pending_task_safety_flag",
|
||||
"../api/test/metrics:global_metrics_logger_and_exporter",
|
||||
"../api/test/metrics:metric",
|
||||
"../api/test/video:function_video_factory",
|
||||
"../api/transport:bitrate_settings",
|
||||
"../api/units:data_rate",
|
||||
"../api/units:data_size",
|
||||
"../api/units:frequency",
|
||||
@ -851,6 +850,8 @@ if (rtc_include_tests) {
|
||||
"../api/video:resolution",
|
||||
"../api/video:video_adaptation",
|
||||
"../api/video:video_bitrate_allocation",
|
||||
"../api/video:video_bitrate_allocator",
|
||||
"../api/video:video_bitrate_allocator_factory",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_type",
|
||||
"../api/video:video_layers_allocation",
|
||||
@ -877,20 +878,15 @@ if (rtc_include_tests) {
|
||||
"../media:media_constants",
|
||||
"../media:rtc_audio_video",
|
||||
"../media:rtc_internal_video_codecs",
|
||||
"../media:rtc_media",
|
||||
"../media:rtc_media_tests_utils",
|
||||
"../media:rtc_simulcast_encoder_adapter",
|
||||
"../media:video_adapter",
|
||||
"../modules:module_api_public",
|
||||
"../modules/pacing",
|
||||
"../modules/rtp_rtcp",
|
||||
"../modules/rtp_rtcp:mock_rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../modules/utility:utility",
|
||||
"../modules/video_coding",
|
||||
"../modules/video_coding:codec_globals_headers",
|
||||
"../modules/video_coding:encoded_frame",
|
||||
"../modules/video_coding:h26x_packet_buffer",
|
||||
"../modules/video_coding:packet_buffer",
|
||||
"../modules/video_coding:video_codec_interface",
|
||||
"../modules/video_coding:video_coding_utility",
|
||||
@ -908,7 +904,7 @@ if (rtc_include_tests) {
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:platform_thread",
|
||||
"../rtc_base:network_route",
|
||||
"../rtc_base:rate_limiter",
|
||||
"../rtc_base:rate_statistics",
|
||||
"../rtc_base:refcount",
|
||||
@ -933,7 +929,6 @@ if (rtc_include_tests) {
|
||||
"../test:fake_encoded_frame",
|
||||
"../test:fake_video_codecs",
|
||||
"../test:field_trial",
|
||||
"../test:fileutils",
|
||||
"../test:frame_generator_capturer",
|
||||
"../test:frame_utils",
|
||||
"../test:mock_transport",
|
||||
@ -945,8 +940,8 @@ if (rtc_include_tests) {
|
||||
"../test:test_support",
|
||||
"../test:video_test_common",
|
||||
"../test:video_test_constants",
|
||||
"../test/network:simulated_network",
|
||||
"../test/time_controller",
|
||||
"adaptation:video_adaptation",
|
||||
"config:encoder_config",
|
||||
"config:streams_config",
|
||||
"config:video_config_tests",
|
||||
|
||||
@ -8,42 +8,82 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <algorithm> // max
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/variant.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/environment/environment_factory.h"
|
||||
#include "api/fec_controller_override.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/task_queue/pending_task_safety_flag.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/test/metrics/global_metrics_logger_and_exporter.h"
|
||||
#include "api/test/metrics/metric.h"
|
||||
#include "api/test/simulated_network.h"
|
||||
#include "api/test/video/function_video_encoder_factory.h"
|
||||
#include "api/transport/bitrate_settings.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
||||
#include "api/video/encoded_image.h"
|
||||
#include "api/video/video_bitrate_allocation.h"
|
||||
#include "api/video/video_bitrate_allocator.h"
|
||||
#include "api/video/video_bitrate_allocator_factory.h"
|
||||
#include "api/video/video_codec_type.h"
|
||||
#include "api/video/video_content_type.h"
|
||||
#include "api/video/video_frame_type.h"
|
||||
#include "api/video/video_rotation.h"
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
#include "api/video_codecs/scalability_mode.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "api/video_codecs/video_codec.h"
|
||||
#include "api/video_codecs/video_encoder.h"
|
||||
#include "call/audio_receive_stream.h"
|
||||
#include "call/audio_send_stream.h"
|
||||
#include "call/call.h"
|
||||
#include "call/fake_network_pipe.h"
|
||||
#include "call/rtp_transport_controller_send.h"
|
||||
#include "call/video_receive_stream.h"
|
||||
#include "call/video_send_stream.h"
|
||||
#include "media/base/video_common.h"
|
||||
#include "media/engine/internal_encoder_factory.h"
|
||||
#include "media/engine/simulcast_encoder_adapter.h"
|
||||
#include "media/engine/webrtc_video_engine.h"
|
||||
#include "modules/include/module_common_types_public.h"
|
||||
#include "modules/rtp_rtcp/include/receive_statistics.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
|
||||
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "modules/rtp_rtcp/source/create_video_rtp_depacketizer.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
|
||||
#include "modules/rtp_rtcp/source/rtcp_sender.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_header_extensions.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_util.h"
|
||||
#include "modules/rtp_rtcp/source/video_rtp_depacketizer.h"
|
||||
#include "modules/rtp_rtcp/source/video_rtp_depacketizer_vp9.h"
|
||||
#include "modules/video_coding/codecs/interface/common_constants.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
|
||||
#include "modules/video_coding/svc/create_scalability_structure.h"
|
||||
#include "modules/video_coding/svc/scalability_mode_util.h"
|
||||
#include "modules/video_coding/svc/scalable_video_controller.h"
|
||||
@ -51,31 +91,33 @@
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/experiments/alr_experiment.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
#include "rtc_base/network_route.h"
|
||||
#include "rtc_base/rate_limiter.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
#include "rtc_base/task_queue_for_test.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "rtc_base/unique_id_generator.h"
|
||||
#include "system_wrappers/include/sleep.h"
|
||||
#include "test/call_test.h"
|
||||
#include "test/configurable_frame_size_encoder.h"
|
||||
#include "test/encoder_settings.h"
|
||||
#include "test/fake_encoder.h"
|
||||
#include "test/fake_texture_frame.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/frame_forwarder.h"
|
||||
#include "test/frame_generator_capturer.h"
|
||||
#include "test/frame_utils.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/network/simulated_network.h"
|
||||
#include "test/null_transport.h"
|
||||
#include "test/rtcp_packet_parser.h"
|
||||
#include "test/rtp_rtcp_observer.h"
|
||||
#include "test/scoped_key_value_config.h"
|
||||
#include "test/video_encoder_proxy_factory.h"
|
||||
#include "test/video_test_constants.h"
|
||||
#include "video/config/encoder_stream_factory.h"
|
||||
#include "video/send_statistics_proxy.h"
|
||||
#include "video/config/video_encoder_config.h"
|
||||
#include "video/transport_adapter.h"
|
||||
#include "video/video_send_stream_impl.h"
|
||||
|
||||
@ -991,12 +1033,11 @@ void VideoSendStreamTest::TestNackRetransmission(
|
||||
// NACK packets at arbitrary points.
|
||||
if (send_count_ % 25 == 0) {
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = Clock::GetRealTimeClock();
|
||||
config.outgoing_transport = transport_adapter_.get();
|
||||
config.rtcp_report_interval = TimeDelta::Millis(kRtcpIntervalMs);
|
||||
config.local_media_ssrc =
|
||||
test::VideoTestConstants::kReceiverLocalVideoSsrc;
|
||||
RTCPSender rtcp_sender(config);
|
||||
RTCPSender rtcp_sender(env_, config);
|
||||
|
||||
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
|
||||
rtcp_sender.SetRemoteSSRC(test::VideoTestConstants::kVideoSendSsrcs[0]);
|
||||
@ -1069,6 +1110,7 @@ void VideoSendStreamTest::TestNackRetransmission(
|
||||
EXPECT_TRUE(Wait()) << "Timed out while waiting for NACK retransmission.";
|
||||
}
|
||||
|
||||
const Environment env_ = CreateEnvironment();
|
||||
std::unique_ptr<internal::TransportAdapter> transport_adapter_;
|
||||
int send_count_;
|
||||
int retransmit_count_;
|
||||
@ -1230,12 +1272,11 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
|
||||
packets_lost_, // Cumulative lost.
|
||||
loss_ratio); // Loss percent.
|
||||
RTCPSender::Configuration config;
|
||||
config.clock = Clock::GetRealTimeClock();
|
||||
config.receive_statistics = &lossy_receive_stats;
|
||||
config.outgoing_transport = transport_adapter_.get();
|
||||
config.rtcp_report_interval = TimeDelta::Millis(kRtcpIntervalMs);
|
||||
config.local_media_ssrc = test::VideoTestConstants::kVideoSendSsrcs[0];
|
||||
RTCPSender rtcp_sender(config);
|
||||
RTCPSender rtcp_sender(env_, config);
|
||||
|
||||
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
|
||||
rtcp_sender.SetRemoteSSRC(test::VideoTestConstants::kVideoSendSsrcs[0]);
|
||||
@ -1296,6 +1337,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
|
||||
EXPECT_TRUE(Wait()) << "Timed out while observing incoming RTP packets.";
|
||||
}
|
||||
|
||||
const Environment env_ = CreateEnvironment();
|
||||
std::unique_ptr<internal::TransportAdapter> transport_adapter_;
|
||||
test::ConfigurableFrameSizeEncoder encoder_;
|
||||
test::VideoEncoderProxyFactory encoder_factory_;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user