Bug 1843113 - Vendor libwebrtc from 8a9f3a8f53

Upstream commit: https://webrtc.googlesource.com/src/+/8a9f3a8f53b2e861faf0ec47642e644f8940f290
    Reland "Remove dependency of video_replay on TestADM."

    This reverts commit f9e3bdd2ce410b18ca7e03b3754f94a18eb7ef3a.

    Reason for revert: reland with fix

    Original change's description:
    > Revert "Remove dependency of video_replay on TestADM."
    >
    > This reverts commit 01716663a9837a26fa292fe70fdea353cbd01a67.
    >
    > Reason for revert:  breaking CallPerfTest
    > https://ci.chromium.org/ui/p/webrtc/builders/perf/Perf%20Android32%20(R%20Pixel5)/967/overview
    >
    > Original change's description:
    > > Remove dependency of video_replay on TestADM.
    > >
    > > This should remove requirement to build TestADM in chromium build.
    > >
    > > Bug: b/272350185, webrtc:15081
    > > Change-Id: Iceb8862aa81099c22bd378ae692229f01ab3314c
    > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/302380
    > > Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
    > > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
    > > Commit-Queue: Artem Titov <titovartem@webrtc.org>
    > > Cr-Commit-Position: refs/heads/main@{#39934}
    >
    > Bug: b/272350185, webrtc:15081
    > Change-Id: I73aa0fd3c3d8c244d20e5f29f5792a4c7d7e4165
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/303160
    > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
    > Owners-Override: Jeremy Leconte <jleconte@google.com>
    > Commit-Queue: Jeremy Leconte <jleconte@google.com>
    > Cr-Commit-Position: refs/heads/main@{#39939}

    Bug: b/272350185, webrtc:15081
    Change-Id: I360ef3e140e60fc21d622480d1f3326e40a76f58
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/303400
    Commit-Queue: Artem Titov <titovartem@webrtc.org>
    Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
    Commit-Queue: Henrik Andreassson <henrika@webrtc.org>
    Auto-Submit: Artem Titov <titovartem@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#39946}
This commit is contained in:
Michael Froman 2023-07-14 15:54:27 -05:00
Родитель 39a7a96968
Коммит c481f9bcb6
45 изменённых файлов: 795 добавлений и 504 удалений

3
third_party/libwebrtc/README.moz-ff-commit поставляемый
Просмотреть файл

@ -23478,3 +23478,6 @@ cde4b67d9d
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
b11caa366c
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
8a9f3a8f53

2
third_party/libwebrtc/README.mozilla поставляемый
Просмотреть файл

@ -15674,3 +15674,5 @@ libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:52:15.724202.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:53:16.938607.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-07-14T20:54:15.172203.

3
third_party/libwebrtc/audio/BUILD.gn поставляемый
Просмотреть файл

@ -139,6 +139,7 @@ if (rtc_include_tests) {
"../system_wrappers",
"../test:test_common",
"../test:test_support",
"../test:video_test_constants",
]
}
@ -217,6 +218,7 @@ if (rtc_include_tests) {
"../test:scoped_key_value_config",
"../test:test_common",
"../test:test_support",
"../test:video_test_constants",
"../test/time_controller:time_controller",
"utility:utility_tests",
"//testing/gtest",
@ -278,6 +280,7 @@ if (rtc_include_tests) {
"../test:test_common",
"../test:test_main",
"../test:test_support",
"../test:video_test_constants",
"../test/pc/e2e:network_quality_metrics_reporter",
"//testing/gtest",
]

Просмотреть файл

@ -19,6 +19,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace test {
@ -31,7 +32,7 @@ enum : int { // The first valid value is 1.
class AudioSendTest : public SendTest {
public:
AudioSendTest() : SendTest(CallTest::kDefaultTimeout) {}
AudioSendTest() : SendTest(VideoTestConstants::kDefaultTimeout) {}
size_t GetNumVideoStreams() const override { return 0; }
size_t GetNumAudioStreams() const override { return 1; }

Просмотреть файл

@ -19,6 +19,7 @@
#include "modules/audio_device/include/test_audio_device.h"
#include "system_wrappers/include/sleep.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace test {
@ -29,7 +30,7 @@ constexpr int kSampleRate = 48000;
} // namespace
AudioEndToEndTest::AudioEndToEndTest()
: EndToEndTest(CallTest::kDefaultTimeout) {}
: EndToEndTest(VideoTestConstants::kDefaultTimeout) {}
size_t AudioEndToEndTest::GetNumVideoStreams() const {
return 0;
@ -66,7 +67,7 @@ void AudioEndToEndTest::ModifyAudioConfigs(
const webrtc::SdpAudioFormat kDefaultFormat("opus", 48000, 2,
{{"stereo", "1"}});
send_config->send_codec_spec = AudioSendStream::Config::SendCodecSpec(
test::CallTest::kAudioSendPayloadType, kDefaultFormat);
test::VideoTestConstants::kAudioSendPayloadType, kDefaultFormat);
send_config->min_bitrate_bps = 32000;
send_config->max_bitrate_bps = 32000;
}

Просмотреть файл

@ -14,6 +14,7 @@
#include "audio/test/audio_end_to_end_test.h"
#include "system_wrappers/include/sleep.h"
#include "test/testsupport/file_utils.h"
#include "test/video_test_constants.h"
ABSL_DECLARE_FLAG(int, sample_rate_hz);
ABSL_DECLARE_FLAG(bool, quick);
@ -78,7 +79,7 @@ class Mobile2GNetworkTest : public AudioQualityTest {
std::vector<AudioReceiveStreamInterface::Config>*
receive_configs) override {
send_config->send_codec_spec = AudioSendStream::Config::SendCodecSpec(
test::CallTest::kAudioSendPayloadType,
test::VideoTestConstants::kAudioSendPayloadType,
{"OPUS",
48000,
2,

2
third_party/libwebrtc/call/BUILD.gn поставляемый
Просмотреть файл

@ -546,6 +546,7 @@ if (rtc_include_tests) {
"../test:scoped_key_value_config",
"../test:test_common",
"../test:test_support",
"../test:video_test_constants",
"../test/scenario",
"../test/time_controller:time_controller",
"../video",
@ -620,6 +621,7 @@ if (rtc_include_tests) {
"../test:test_common",
"../test:test_support",
"../test:video_test_common",
"../test:video_test_constants",
"../video",
"../video/config:encoder_config",
"//testing/gtest",

Просмотреть файл

@ -29,6 +29,7 @@
#include "test/fake_encoder.h"
#include "test/frame_generator_capturer.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -80,7 +81,9 @@ class LogObserver {
}
}
bool Wait() { return done_.Wait(test::CallTest::kDefaultTimeout); }
bool Wait() {
return done_.Wait(test::VideoTestConstants::kDefaultTimeout);
}
void PushExpectedLogLine(absl::string_view expected_log_line) {
MutexLock lock(&mutex_);
@ -122,13 +125,15 @@ class BitrateEstimatorTest : public test::CallTest {
/*observer=*/nullptr);
VideoSendStream::Config video_send_config(send_transport_.get());
video_send_config.rtp.ssrcs.push_back(kVideoSendSsrcs[0]);
video_send_config.rtp.ssrcs.push_back(
test::VideoTestConstants::kVideoSendSsrcs[0]);
video_send_config.encoder_settings.encoder_factory =
&fake_encoder_factory_;
video_send_config.encoder_settings.bitrate_allocator_factory =
bitrate_allocator_factory_.get();
video_send_config.rtp.payload_name = "FAKE";
video_send_config.rtp.payload_type = kFakeVideoSendPayloadType;
video_send_config.rtp.payload_type =
test::VideoTestConstants::kFakeVideoSendPayloadType;
SetVideoSendConfig(video_send_config);
VideoEncoderConfig video_encoder_config;
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
@ -138,7 +143,8 @@ class BitrateEstimatorTest : public test::CallTest {
VideoReceiveStreamInterface::Config(receive_transport_.get());
// receive_config_.decoders will be set by every stream separately.
receive_config_.rtp.remote_ssrc = GetVideoSendConfig()->rtp.ssrcs[0];
receive_config_.rtp.local_ssrc = kReceiverLocalVideoSsrc;
receive_config_.rtp.local_ssrc =
test::VideoTestConstants::kReceiverLocalVideoSsrc;
});
}
@ -173,9 +179,12 @@ class BitrateEstimatorTest : public test::CallTest {
frame_generator_capturer_ =
std::make_unique<test::FrameGeneratorCapturer>(
test->clock_,
test::CreateSquareFrameGenerator(kDefaultWidth, kDefaultHeight,
absl::nullopt, absl::nullopt),
kDefaultFramerate, *test->task_queue_factory_);
test::CreateSquareFrameGenerator(
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight, absl::nullopt,
absl::nullopt),
test::VideoTestConstants::kDefaultFramerate,
*test->task_queue_factory_);
frame_generator_capturer_->Init();
send_stream_->SetSource(frame_generator_capturer_.get(),
DegradationPreference::MAINTAIN_FRAMERATE);

60
third_party/libwebrtc/call/call_perf_tests.cc поставляемый
Просмотреть файл

@ -54,6 +54,7 @@
#include "test/rtp_rtcp_observer.h"
#include "test/testsupport/file_utils.h"
#include "test/video_encoder_proxy_factory.h"
#include "test/video_test_constants.h"
#include "video/config/video_encoder_config.h"
#include "video/transport_adapter.h"
@ -116,7 +117,7 @@ class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver,
explicit VideoRtcpAndSyncObserver(TaskQueueBase* task_queue,
Clock* clock,
absl::string_view test_label)
: test::RtpRtcpObserver(CallPerfTest::kLongTimeout),
: test::RtpRtcpObserver(test::VideoTestConstants::kLongTimeout),
clock_(clock),
test_label_(test_label),
creation_time_ms_(clock_->TimeInMilliseconds()),
@ -274,18 +275,23 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
audio_send_config.rtp.ssrc = kAudioSendSsrc;
// TODO(bugs.webrtc.org/14683): Let the tests fail with invalid config.
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType, {"OPUS", 48000, 2});
test::VideoTestConstants::kAudioSendPayloadType, {"OPUS", 48000, 2});
audio_send_config.min_bitrate_bps = 6000;
audio_send_config.max_bitrate_bps = 510000;
audio_send_config.encoder_factory = CreateBuiltinAudioEncoderFactory();
audio_send_stream = sender_call_->CreateAudioSendStream(audio_send_config);
GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
GetVideoSendConfig()->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
if (fec == FecMode::kOn) {
GetVideoSendConfig()->rtp.ulpfec.red_payload_type = kRedPayloadType;
GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
video_receive_configs_[0].rtp.red_payload_type = kRedPayloadType;
video_receive_configs_[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
GetVideoSendConfig()->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
video_receive_configs_[0].rtp.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
video_receive_configs_[0].rtp.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
}
video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000;
video_receive_configs_[0].renderer = observer.get();
@ -298,7 +304,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
audio_recv_config.sync_group = kSyncGroup;
audio_recv_config.decoder_factory = audio_decoder_factory_;
audio_recv_config.decoder_map = {
{kAudioSendPayloadType, {"OPUS", 48000, 2}}};
{test::VideoTestConstants::kAudioSendPayloadType, {"OPUS", 48000, 2}}};
if (create_first == CreateOrder::kAudioFirst) {
audio_receive_stream =
@ -312,9 +318,11 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
EXPECT_EQ(1u, video_receive_streams_.size());
observer->set_receive_stream(video_receive_streams_[0]);
drifting_clock = std::make_unique<DriftingClock>(clock_, video_ntp_speed);
CreateFrameGeneratorCapturerWithDrift(drifting_clock.get(), video_rtp_speed,
kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturerWithDrift(
drifting_clock.get(), video_rtp_speed,
test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
Start();
@ -405,7 +413,7 @@ void CallPerfTest::TestCaptureNtpTime(
int threshold_ms,
int start_time_ms,
int run_time_ms)
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
net_config_(net_config),
clock_(Clock::GetRealTimeClock()),
threshold_ms_(threshold_ms),
@ -558,7 +566,9 @@ TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
class LoadObserver : public test::SendTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
LoadObserver() : SendTest(kLongTimeout), test_phase_(TestPhase::kInit) {}
LoadObserver()
: SendTest(test::VideoTestConstants::kLongTimeout),
test_phase_(TestPhase::kInit) {}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
@ -667,7 +677,7 @@ void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
public:
explicit BitrateObserver(bool using_min_transmit_bitrate,
TaskQueueBase* task_queue)
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
send_stream_(nullptr),
converged_(false),
pad_to_min_bitrate_(using_min_transmit_bitrate),
@ -794,7 +804,7 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder {
public:
explicit BitrateObserver(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
encoder_inits_(0),
last_set_bitrate_kbps_(0),
@ -818,11 +828,11 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
: kInitialBitrateKbps - kInitialBitrateOverheadKpbs;
EXPECT_EQ(expected_bitrate, config->startBitrate)
<< "Encoder not initialized at expected bitrate.";
EXPECT_EQ(kDefaultWidth, config->width);
EXPECT_EQ(kDefaultHeight, config->height);
EXPECT_EQ(test::VideoTestConstants::kDefaultWidth, config->width);
EXPECT_EQ(test::VideoTestConstants::kDefaultHeight, config->height);
} else if (encoder_inits_ == 2) {
EXPECT_EQ(2 * kDefaultWidth, config->width);
EXPECT_EQ(2 * kDefaultHeight, config->height);
EXPECT_EQ(2 * test::VideoTestConstants::kDefaultWidth, config->width);
EXPECT_EQ(2 * test::VideoTestConstants::kDefaultHeight, config->height);
EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps);
EXPECT_GT(config->startBitrate, kReconfigureThresholdKbps)
<< "Encoder reconfigured with bitrate too far away from last set.";
@ -871,9 +881,12 @@ TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
}
void PerformTest() override {
ASSERT_TRUE(time_to_reconfigure_.Wait(kDefaultTimeout))
ASSERT_TRUE(
time_to_reconfigure_.Wait(test::VideoTestConstants::kDefaultTimeout))
<< "Timed out before receiving an initial high bitrate.";
frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2);
frame_generator_->ChangeResolution(
test::VideoTestConstants::kDefaultWidth * 2,
test::VideoTestConstants::kDefaultHeight * 2);
SendTask(task_queue_, [&]() {
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
});
@ -1057,7 +1070,7 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
absl::string_view payload_name,
const std::vector<int>& max_framerates,
TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
clock_(Clock::GetRealTimeClock()),
encoder_factory_(encoder_factory),
payload_name_(payload_name),
@ -1096,7 +1109,8 @@ void CallPerfTest::TestEncodeFramerate(VideoEncoderFactory* encoder_factory,
VideoEncoderConfig* encoder_config) override {
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
encoder_config->codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->max_bitrate_bps = kMaxBitrate.bps();

31
third_party/libwebrtc/call/rampup_tests.cc поставляемый
Просмотреть файл

@ -30,6 +30,7 @@
#include "rtc_base/time_utils.h"
#include "test/encoder_settings.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
ABSL_FLAG(std::string,
ramp_dump_name,
@ -69,7 +70,7 @@ RampUpTester::RampUpTester(size_t num_video_streams,
bool red,
bool report_perf_stats,
TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
clock_(Clock::GetRealTimeClock()),
num_video_streams_(num_video_streams),
num_audio_streams_(num_audio_streams),
@ -163,8 +164,8 @@ void RampUpTester::ModifyVideoConfigs(
send_config->rtp.payload_name = "VP8";
encoder_config->codec_type = kVideoCodecVP8;
std::vector<VideoStream> streams = test::CreateVideoStreams(
test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
*encoder_config);
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight, *encoder_config);
// For multi stream rampup until all streams are being sent. That means
// enough bitrate to send all the target streams plus the min bitrate of
// the last one.
@ -174,19 +175,22 @@ void RampUpTester::ModifyVideoConfigs(
}
}
send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
send_config->rtp.ssrcs = video_ssrcs_;
if (rtx_) {
send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
}
if (red_) {
send_config->rtp.ulpfec.ulpfec_payload_type =
test::CallTest::kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType;
test::VideoTestConstants::kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
if (rtx_) {
send_config->rtp.ulpfec.red_rtx_payload_type =
test::CallTest::kRtxRedPayloadType;
test::VideoTestConstants::kRtxRedPayloadType;
}
}
@ -223,8 +227,9 @@ void RampUpTester::ModifyVideoConfigs(
RTC_DCHECK_LE(num_flexfec_streams_, 1);
if (num_flexfec_streams_ == 1) {
send_config->rtp.flexfec.payload_type = test::CallTest::kFlexfecPayloadType;
send_config->rtp.flexfec.ssrc = test::CallTest::kFlexfecSendSsrc;
send_config->rtp.flexfec.payload_type =
test::VideoTestConstants::kFlexfecPayloadType;
send_config->rtp.flexfec.ssrc = test::VideoTestConstants::kFlexfecSendSsrc;
send_config->rtp.flexfec.protected_media_ssrcs = {video_ssrcs_[0]};
}
}
@ -249,8 +254,10 @@ void RampUpTester::ModifyFlexfecConfigs(
if (num_flexfec_streams_ == 0)
return;
RTC_DCHECK_EQ(1, num_flexfec_streams_);
(*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
(*receive_configs)[0].rtp.remote_ssrc = test::CallTest::kFlexfecSendSsrc;
(*receive_configs)[0].payload_type =
test::VideoTestConstants::kFlexfecPayloadType;
(*receive_configs)[0].rtp.remote_ssrc =
test::VideoTestConstants::kFlexfecSendSsrc;
(*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
(*receive_configs)[0].rtp.local_ssrc = video_ssrcs_[0];
}

Просмотреть файл

@ -303,7 +303,7 @@ index 54132bcdbb..cf8b3ad3dc 100644
bool RtpExtension::IsSupportedForVideo(absl::string_view uri) {
diff --git a/call/BUILD.gn b/call/BUILD.gn
index bf22820b69..7311483d66 100644
index c40cfcf28e..63a3a2d53d 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -20,6 +20,7 @@ rtc_library("call_interfaces") {

Просмотреть файл

@ -405,7 +405,7 @@ index 12a1f57066..d8f095c700 100644
if (rtc_include_tests) {
rtc_source_set("test_feedback_generator_interface") {
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 7311483d66..e7c2af7829 100644
index 63a3a2d53d..a85ad0c0d4 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -46,7 +46,7 @@ rtc_library("call_interfaces") {
@ -1014,7 +1014,7 @@ index 77f5139a2f..486b37590c 100644
deps += [
"..:logging",
diff --git a/test/BUILD.gn b/test/BUILD.gn
index bd0ba3c81e..87b63980ad 100644
index bda12289c2..55153909d3 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -240,6 +240,7 @@ rtc_library("audio_test_common") {
@ -1056,7 +1056,7 @@ index bd0ba3c81e..87b63980ad 100644
sources += [ "testsupport/jpeg_frame_writer.cc" ]
} else {
sources += [ "testsupport/jpeg_frame_writer_ios.cc" ]
@@ -1133,6 +1141,10 @@ rtc_library("test_common") {
@@ -1140,6 +1148,10 @@ rtc_library("test_common") {
if (!is_android && !build_with_chromium) {
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
@ -1067,7 +1067,7 @@ index bd0ba3c81e..87b63980ad 100644
}
rtc_library("mock_transport") {
@@ -1300,6 +1312,7 @@ rtc_library("copy_to_file_audio_capturer_unittest") {
@@ -1307,6 +1319,7 @@ rtc_library("copy_to_file_audio_capturer_unittest") {
]
}
@ -1075,7 +1075,7 @@ index bd0ba3c81e..87b63980ad 100644
if (!build_with_chromium && is_android) {
rtc_android_library("native_test_java") {
testonly = true
@@ -1313,6 +1326,7 @@ if (!build_with_chromium && is_android) {
@@ -1320,6 +1333,7 @@ if (!build_with_chromium && is_android) {
]
}
}
@ -1084,7 +1084,7 @@ index bd0ba3c81e..87b63980ad 100644
rtc_library("call_config_utils") {
# TODO(bugs.webrtc.org/10814): Remove rtc_json_suppressions as soon as it
diff --git a/video/BUILD.gn b/video/BUILD.gn
index 78b6e78d14..7086dc649a 100644
index e4d3c51c36..ea8bbdfbb2 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -17,7 +17,7 @@ rtc_library("video_stream_encoder_interface") {

Просмотреть файл

@ -15,7 +15,7 @@ Subject: Bug 1766646 - (fix) breakout Call::Stats and SharedModuleThread into
create mode 100644 call/call_basic_stats.h
diff --git a/call/BUILD.gn b/call/BUILD.gn
index e7c2af7829..96b033f152 100644
index a85ad0c0d4..20e9241a83 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -33,6 +33,12 @@ rtc_library("call_interfaces") {

2
third_party/libwebrtc/rtc_tools/BUILD.gn поставляемый
Просмотреть файл

@ -282,11 +282,11 @@ if (!is_component_build) {
"../test:run_loop",
"../test:run_test",
"../test:run_test_interface",
"../test:test_common",
"../test:test_renderer",
"../test:test_support",
"../test:test_video_capturer",
"../test:video_test_common",
"../test:video_test_constants",
"../test:video_test_support",
"../test/time_controller:time_controller",
"//third_party/abseil-cpp/absl/flags:flag",

Просмотреть файл

@ -40,7 +40,6 @@
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/sleep.h"
#include "test/call_config_utils.h"
#include "test/call_test.h"
#include "test/encoder_settings.h"
#include "test/fake_decoder.h"
#include "test/gtest.h"
@ -52,54 +51,55 @@
#include "test/testsupport/frame_writer.h"
#include "test/time_controller/simulated_time_controller.h"
#include "test/video_renderer.h"
#include "test/video_test_constants.h"
// Flag for payload type.
ABSL_FLAG(int,
media_payload_type,
webrtc::test::CallTest::kPayloadTypeVP8,
webrtc::test::VideoTestConstants::kPayloadTypeVP8,
"Media payload type");
// Flag for RED payload type.
ABSL_FLAG(int,
red_payload_type,
webrtc::test::CallTest::kRedPayloadType,
webrtc::test::VideoTestConstants::kRedPayloadType,
"RED payload type");
// Flag for ULPFEC payload type.
ABSL_FLAG(int,
ulpfec_payload_type,
webrtc::test::CallTest::kUlpfecPayloadType,
webrtc::test::VideoTestConstants::kUlpfecPayloadType,
"ULPFEC payload type");
// Flag for FLEXFEC payload type.
ABSL_FLAG(int,
flexfec_payload_type,
webrtc::test::CallTest::kFlexfecPayloadType,
webrtc::test::VideoTestConstants::kFlexfecPayloadType,
"FLEXFEC payload type");
ABSL_FLAG(int,
media_payload_type_rtx,
webrtc::test::CallTest::kSendRtxPayloadType,
webrtc::test::VideoTestConstants::kSendRtxPayloadType,
"Media over RTX payload type");
ABSL_FLAG(int,
red_payload_type_rtx,
webrtc::test::CallTest::kRtxRedPayloadType,
webrtc::test::VideoTestConstants::kRtxRedPayloadType,
"RED over RTX payload type");
// Flag for SSRC and RTX SSRC.
ABSL_FLAG(uint32_t,
ssrc,
webrtc::test::CallTest::kVideoSendSsrcs[0],
webrtc::test::VideoTestConstants::kVideoSendSsrcs[0],
"Incoming SSRC");
ABSL_FLAG(uint32_t,
ssrc_rtx,
webrtc::test::CallTest::kSendRtxSsrcs[0],
webrtc::test::VideoTestConstants::kSendRtxSsrcs[0],
"Incoming RTX SSRC");
ABSL_FLAG(uint32_t,
ssrc_flexfec,
webrtc::test::CallTest::kFlexfecSendSsrc,
webrtc::test::VideoTestConstants::kFlexfecSendSsrc,
"Incoming FLEXFEC SSRC");
// Flag for abs-send-time id.

7
third_party/libwebrtc/test/BUILD.gn поставляемый
Просмотреть файл

@ -1072,6 +1072,12 @@ rtc_library("run_loop") {
absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
}
rtc_library("video_test_constants") {
testonly = true
sources = [ "video_test_constants.h" ]
deps = [ "../api/units:time_delta" ]
}
rtc_library("test_common") {
testonly = true
sources = [
@ -1095,6 +1101,7 @@ rtc_library("test_common") {
":scoped_key_value_config",
":test_support",
":video_test_common",
":video_test_constants",
"../api:array_view",
"../api:create_frame_generator",
"../api:frame_generator_api",

97
third_party/libwebrtc/test/call_test.cc поставляемый
Просмотреть файл

@ -31,6 +31,7 @@
#include "test/fake_encoder.h"
#include "test/rtp_rtcp_observer.h"
#include "test/testsupport/file_utils.h"
#include "test/video_test_constants.h"
#include "video/config/video_encoder_config.h"
namespace webrtc {
@ -176,9 +177,9 @@ void CallTest::RunBaseTest(BaseTest* test) {
}
if (num_video_streams_ > 0) {
int width = kDefaultWidth;
int height = kDefaultHeight;
int frame_rate = kDefaultFramerate;
int width = VideoTestConstants::kDefaultWidth;
int height = VideoTestConstants::kDefaultHeight;
int frame_rate = VideoTestConstants::kDefaultFramerate;
test->ModifyVideoCaptureStartResolution(&width, &height, &frame_rate);
test->ModifyVideoDegradationPreference(&degradation_preference_);
CreateFrameGeneratorCapturer(frame_rate, width, height);
@ -248,13 +249,15 @@ void CallTest::CreateVideoSendConfig(VideoSendStream::Config* video_config,
size_t num_video_streams,
size_t num_used_ssrcs,
Transport* send_transport) {
RTC_DCHECK_LE(num_video_streams + num_used_ssrcs, kNumSsrcs);
RTC_DCHECK_LE(num_video_streams + num_used_ssrcs,
VideoTestConstants::kNumSsrcs);
*video_config = VideoSendStream::Config(send_transport);
video_config->encoder_settings.encoder_factory = &fake_encoder_factory_;
video_config->encoder_settings.bitrate_allocator_factory =
bitrate_allocator_factory_.get();
video_config->rtp.payload_name = "FAKE";
video_config->rtp.payload_type = kFakeVideoSendPayloadType;
video_config->rtp.payload_type =
VideoTestConstants::kFakeVideoSendPayloadType;
video_config->rtp.extmap_allow_mixed = true;
AddRtpExtensionByUri(RtpExtension::kTransportSequenceNumberUri,
&video_config->rtp.extensions);
@ -274,7 +277,8 @@ void CallTest::CreateVideoSendConfig(VideoSendStream::Config* video_config,
&video_encoder_configs_.back());
}
for (size_t i = 0; i < num_video_streams; ++i)
video_config->rtp.ssrcs.push_back(kVideoSendSsrcs[num_used_ssrcs + i]);
video_config->rtp.ssrcs.push_back(
VideoTestConstants::kVideoSendSsrcs[num_used_ssrcs + i]);
AddRtpExtensionByUri(RtpExtension::kVideoRotationUri,
&video_config->rtp.extensions);
AddRtpExtensionByUri(RtpExtension::kColorSpaceUri,
@ -288,12 +292,13 @@ void CallTest::CreateAudioAndFecSendConfigs(size_t num_audio_streams,
RTC_DCHECK_LE(num_flexfec_streams, 1);
if (num_audio_streams > 0) {
AudioSendStream::Config audio_send_config(send_transport);
audio_send_config.rtp.ssrc = kAudioSendSsrc;
audio_send_config.rtp.ssrc = VideoTestConstants::kAudioSendSsrc;
AddRtpExtensionByUri(RtpExtension::kTransportSequenceNumberUri,
&audio_send_config.rtp.extensions);
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType, {"opus", 48000, 2, {{"stereo", "1"}}});
VideoTestConstants::kAudioSendPayloadType,
{"opus", 48000, 2, {{"stereo", "1"}}});
audio_send_config.min_bitrate_bps = 6000;
audio_send_config.max_bitrate_bps = 60000;
audio_send_config.encoder_factory = audio_encoder_factory_;
@ -302,7 +307,7 @@ void CallTest::CreateAudioAndFecSendConfigs(size_t num_audio_streams,
// TODO(brandtr): Update this when we support multistream protection.
if (num_flexfec_streams > 0) {
SetSendFecConfig({kVideoSendSsrcs[0]});
SetSendFecConfig({VideoTestConstants::kVideoSendSsrcs[0]});
}
}
@ -311,23 +316,29 @@ void CallTest::SetAudioConfig(const AudioSendStream::Config& config) {
}
void CallTest::SetSendFecConfig(std::vector<uint32_t> video_send_ssrcs) {
GetVideoSendConfig()->rtp.flexfec.payload_type = kFlexfecPayloadType;
GetVideoSendConfig()->rtp.flexfec.ssrc = kFlexfecSendSsrc;
GetVideoSendConfig()->rtp.flexfec.payload_type =
VideoTestConstants::kFlexfecPayloadType;
GetVideoSendConfig()->rtp.flexfec.ssrc = VideoTestConstants::kFlexfecSendSsrc;
GetVideoSendConfig()->rtp.flexfec.protected_media_ssrcs = video_send_ssrcs;
}
void CallTest::SetSendUlpFecConfig(VideoSendStream::Config* send_config) {
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType;
send_config->rtp.ulpfec.red_payload_type =
VideoTestConstants::kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
VideoTestConstants::kUlpfecPayloadType;
send_config->rtp.ulpfec.red_rtx_payload_type =
VideoTestConstants::kRtxRedPayloadType;
}
void CallTest::SetReceiveUlpFecConfig(
VideoReceiveStreamInterface::Config* receive_config) {
receive_config->rtp.red_payload_type = kRedPayloadType;
receive_config->rtp.ulpfec_payload_type = kUlpfecPayloadType;
receive_config->rtp.rtx_associated_payload_types[kRtxRedPayloadType] =
kRedPayloadType;
receive_config->rtp.red_payload_type = VideoTestConstants::kRedPayloadType;
receive_config->rtp.ulpfec_payload_type =
VideoTestConstants::kUlpfecPayloadType;
receive_config->rtp
.rtx_associated_payload_types[VideoTestConstants::kRtxRedPayloadType] =
VideoTestConstants::kRedPayloadType;
}
void CallTest::CreateSendConfig(size_t num_video_streams,
@ -375,7 +386,7 @@ void CallTest::AddMatchingVideoReceiveConfigs(
int rtp_history_ms) {
RTC_DCHECK(!video_send_config.rtp.ssrcs.empty());
VideoReceiveStreamInterface::Config default_config(rtcp_send_transport);
default_config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
default_config.rtp.local_ssrc = VideoTestConstants::kReceiverLocalVideoSsrc;
default_config.rtp.nack.rtp_history_ms = rtp_history_ms;
// Enable RTT calculation so NTP time estimator will work.
default_config.rtp.rtcp_xr.receiver_reference_time_report =
@ -388,7 +399,8 @@ void CallTest::AddMatchingVideoReceiveConfigs(
video_recv_config.decoders.clear();
if (!video_send_config.rtp.rtx.ssrcs.empty()) {
video_recv_config.rtp.rtx_ssrc = video_send_config.rtp.rtx.ssrcs[i];
video_recv_config.rtp.rtx_associated_payload_types[kSendRtxPayloadType] =
video_recv_config.rtp.rtx_associated_payload_types
[VideoTestConstants::kSendRtxPayloadType] =
video_send_config.rtp.payload_type;
}
video_recv_config.rtp.remote_ssrc = video_send_config.rtp.ssrcs[i];
@ -433,11 +445,12 @@ AudioReceiveStreamInterface::Config CallTest::CreateMatchingAudioConfig(
Transport* transport,
std::string sync_group) {
AudioReceiveStreamInterface::Config audio_config;
audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
audio_config.rtp.local_ssrc = VideoTestConstants::kReceiverLocalAudioSsrc;
audio_config.rtcp_send_transport = transport;
audio_config.rtp.remote_ssrc = send_config.rtp.ssrc;
audio_config.decoder_factory = audio_decoder_factory;
audio_config.decoder_map = {{kAudioSendPayloadType, {"opus", 48000, 2}}};
audio_config.decoder_map = {
{VideoTestConstants::kAudioSendPayloadType, {"opus", 48000, 2}}};
audio_config.sync_group = sync_group;
return audio_config;
}
@ -449,7 +462,7 @@ void CallTest::CreateMatchingFecConfig(
config.payload_type = send_config.rtp.flexfec.payload_type;
config.rtp.remote_ssrc = send_config.rtp.flexfec.ssrc;
config.protected_media_ssrcs = send_config.rtp.flexfec.protected_media_ssrcs;
config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
config.rtp.local_ssrc = VideoTestConstants::kReceiverLocalVideoSsrc;
if (!video_receive_configs_.empty()) {
video_receive_configs_[0].rtp.protected_by_flexfec = true;
video_receive_configs_[0].rtp.packet_sink_ = this;
@ -730,33 +743,19 @@ void CallTest::AddRtpExtensionByUri(
}
}
constexpr size_t CallTest::kNumSsrcs;
const int CallTest::kDefaultWidth;
const int CallTest::kDefaultHeight;
const int CallTest::kDefaultFramerate;
const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {
0xBADCAFD, 0xBADCAFE, 0xBADCAFF, 0xBADCB00, 0xBADCB01, 0xBADCB02};
const uint32_t CallTest::kVideoSendSsrcs[kNumSsrcs] = {
0xC0FFED, 0xC0FFEE, 0xC0FFEF, 0xC0FFF0, 0xC0FFF1, 0xC0FFF2};
const uint32_t CallTest::kAudioSendSsrc = 0xDEADBEEF;
const uint32_t CallTest::kFlexfecSendSsrc = 0xBADBEEF;
const uint32_t CallTest::kReceiverLocalVideoSsrc = 0x123456;
const uint32_t CallTest::kReceiverLocalAudioSsrc = 0x1234567;
const int CallTest::kNackRtpHistoryMs = 1000;
const std::map<uint8_t, MediaType> CallTest::payload_type_map_ = {
{CallTest::kVideoSendPayloadType, MediaType::VIDEO},
{CallTest::kFakeVideoSendPayloadType, MediaType::VIDEO},
{CallTest::kSendRtxPayloadType, MediaType::VIDEO},
{CallTest::kPayloadTypeVP8, MediaType::VIDEO},
{CallTest::kPayloadTypeVP9, MediaType::VIDEO},
{CallTest::kPayloadTypeH264, MediaType::VIDEO},
{CallTest::kPayloadTypeGeneric, MediaType::VIDEO},
{CallTest::kRedPayloadType, MediaType::VIDEO},
{CallTest::kRtxRedPayloadType, MediaType::VIDEO},
{CallTest::kUlpfecPayloadType, MediaType::VIDEO},
{CallTest::kFlexfecPayloadType, MediaType::VIDEO},
{CallTest::kAudioSendPayloadType, MediaType::AUDIO}};
{VideoTestConstants::kVideoSendPayloadType, MediaType::VIDEO},
{VideoTestConstants::kFakeVideoSendPayloadType, MediaType::VIDEO},
{VideoTestConstants::kSendRtxPayloadType, MediaType::VIDEO},
{VideoTestConstants::kPayloadTypeVP8, MediaType::VIDEO},
{VideoTestConstants::kPayloadTypeVP9, MediaType::VIDEO},
{VideoTestConstants::kPayloadTypeH264, MediaType::VIDEO},
{VideoTestConstants::kPayloadTypeGeneric, MediaType::VIDEO},
{VideoTestConstants::kRedPayloadType, MediaType::VIDEO},
{VideoTestConstants::kRtxRedPayloadType, MediaType::VIDEO},
{VideoTestConstants::kUlpfecPayloadType, MediaType::VIDEO},
{VideoTestConstants::kFlexfecPayloadType, MediaType::VIDEO},
{VideoTestConstants::kAudioSendPayloadType, MediaType::AUDIO}};
BaseTest::BaseTest() {}

29
third_party/libwebrtc/test/call_test.h поставляемый
Просмотреть файл

@ -36,6 +36,7 @@
#include "test/rtp_rtcp_observer.h"
#include "test/run_loop.h"
#include "test/scoped_key_value_config.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace test {
@ -47,34 +48,6 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface {
CallTest();
virtual ~CallTest();
static constexpr size_t kNumSsrcs = 6;
static const int kNumSimulcastStreams = 3;
static const int kDefaultWidth = 320;
static const int kDefaultHeight = 180;
static const int kDefaultFramerate = 30;
static constexpr TimeDelta kDefaultTimeout = TimeDelta::Seconds(30);
static constexpr TimeDelta kLongTimeout = TimeDelta::Seconds(120);
enum classPayloadTypes : uint8_t {
kSendRtxPayloadType = 98,
kRtxRedPayloadType = 99,
kVideoSendPayloadType = 100,
kAudioSendPayloadType = 103,
kRedPayloadType = 118,
kUlpfecPayloadType = 119,
kFlexfecPayloadType = 120,
kPayloadTypeH264 = 122,
kPayloadTypeVP8 = 123,
kPayloadTypeVP9 = 124,
kPayloadTypeGeneric = 125,
kFakeVideoSendPayloadType = 126,
};
static const uint32_t kSendRtxSsrcs[kNumSsrcs];
static const uint32_t kVideoSendSsrcs[kNumSsrcs];
static const uint32_t kAudioSendSsrc;
static const uint32_t kFlexfecSendSsrc;
static const uint32_t kReceiverLocalVideoSsrc;
static const uint32_t kReceiverLocalAudioSsrc;
static const int kNackRtpHistoryMs;
static const std::map<uint8_t, MediaType> payload_type_map_;
protected:

Просмотреть файл

@ -71,6 +71,7 @@ if (rtc_include_tests && !build_with_chromium) {
":column_printer",
"..:frame_generator_capturer",
"..:test_video_capturer",
"..:video_test_constants",
"../:fake_video_codecs",
"../:fileutils",
"../:test_common",

Просмотреть файл

@ -11,6 +11,7 @@
#include "absl/memory/memory.h"
#include "test/call_test.h"
#include "test/video_test_constants.h"
#if WEBRTC_ENABLE_PROTOBUF
RTC_PUSH_IGNORING_WUNDEF()
@ -103,7 +104,8 @@ SendAudioStream::SendAudioStream(
// stereo, but the actual channel count used is based on the "stereo"
// parameter.
send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
CallTest::kAudioSendPayloadType, {"opus", 48000, 2, sdp_params});
VideoTestConstants::kAudioSendPayloadType,
{"opus", 48000, 2, sdp_params});
RTC_DCHECK_LE(config.source.channels, 2);
send_config.encoder_factory = encoder_factory;
@ -190,7 +192,7 @@ ReceiveAudioStream::ReceiveAudioStream(
receiver->ssrc_media_types_[recv_config.rtp.remote_ssrc] = MediaType::AUDIO;
recv_config.decoder_factory = decoder_factory;
recv_config.decoder_map = {
{CallTest::kAudioSendPayloadType, {"opus", 48000, 2}}};
{VideoTestConstants::kAudioSendPayloadType, {"opus", 48000, 2}}};
recv_config.sync_group = config.render.sync_group;
receiver_->SendTask([&] {
receive_stream_ = receiver_->call_->CreateAudioReceiveStream(recv_config);

Просмотреть файл

@ -27,6 +27,7 @@
#include "test/fake_encoder.h"
#include "test/scenario/hardware_codecs.h"
#include "test/testsupport/file_utils.h"
#include "test/video_test_constants.h"
#include "video/config/encoder_stream_factory.h"
namespace webrtc {
@ -43,13 +44,13 @@ constexpr int kDefaultMaxQp = cricket::WebRtcVideoChannel::kDefaultQpMax;
uint8_t CodecTypeToPayloadType(VideoCodecType codec_type) {
switch (codec_type) {
case VideoCodecType::kVideoCodecGeneric:
return CallTest::kFakeVideoSendPayloadType;
return VideoTestConstants::kFakeVideoSendPayloadType;
case VideoCodecType::kVideoCodecVP8:
return CallTest::kPayloadTypeVP8;
return VideoTestConstants::kPayloadTypeVP8;
case VideoCodecType::kVideoCodecVP9:
return CallTest::kPayloadTypeVP9;
return VideoTestConstants::kPayloadTypeVP9;
case VideoCodecType::kVideoCodecH264:
return CallTest::kPayloadTypeH264;
return VideoTestConstants::kPayloadTypeH264;
default:
RTC_DCHECK_NOTREACHED();
}
@ -108,18 +109,22 @@ VideoSendStream::Config CreateVideoSendStreamConfig(
send_config.rtp.extensions = GetVideoRtpExtensions(config);
if (config.stream.use_rtx) {
send_config.rtp.rtx.payload_type = CallTest::kSendRtxPayloadType;
send_config.rtp.rtx.payload_type = VideoTestConstants::kSendRtxPayloadType;
send_config.rtp.rtx.ssrcs = rtx_ssrcs;
}
if (config.stream.use_flexfec) {
send_config.rtp.flexfec.payload_type = CallTest::kFlexfecPayloadType;
send_config.rtp.flexfec.ssrc = CallTest::kFlexfecSendSsrc;
send_config.rtp.flexfec.payload_type =
VideoTestConstants::kFlexfecPayloadType;
send_config.rtp.flexfec.ssrc = VideoTestConstants::kFlexfecSendSsrc;
send_config.rtp.flexfec.protected_media_ssrcs = ssrcs;
}
if (config.stream.use_ulpfec) {
send_config.rtp.ulpfec.red_payload_type = CallTest::kRedPayloadType;
send_config.rtp.ulpfec.ulpfec_payload_type = CallTest::kUlpfecPayloadType;
send_config.rtp.ulpfec.red_rtx_payload_type = CallTest::kRtxRedPayloadType;
send_config.rtp.ulpfec.red_payload_type =
VideoTestConstants::kRedPayloadType;
send_config.rtp.ulpfec.ulpfec_payload_type =
VideoTestConstants::kUlpfecPayloadType;
send_config.rtp.ulpfec.red_rtx_payload_type =
VideoTestConstants::kRtxRedPayloadType;
}
return send_config;
}
@ -323,14 +328,16 @@ VideoReceiveStreamInterface::Config CreateVideoReceiveStreamConfig(
recv.renderer = renderer;
if (config.stream.use_rtx) {
recv.rtp.rtx_ssrc = rtx_ssrc;
recv.rtp.rtx_associated_payload_types[CallTest::kSendRtxPayloadType] =
recv.rtp
.rtx_associated_payload_types[VideoTestConstants::kSendRtxPayloadType] =
CodecTypeToPayloadType(config.encoder.codec);
}
if (config.stream.use_ulpfec) {
recv.rtp.red_payload_type = CallTest::kRedPayloadType;
recv.rtp.ulpfec_payload_type = CallTest::kUlpfecPayloadType;
recv.rtp.rtx_associated_payload_types[CallTest::kRtxRedPayloadType] =
CallTest::kRedPayloadType;
recv.rtp.red_payload_type = VideoTestConstants::kRedPayloadType;
recv.rtp.ulpfec_payload_type = VideoTestConstants::kUlpfecPayloadType;
recv.rtp
.rtx_associated_payload_types[VideoTestConstants::kRtxRedPayloadType] =
VideoTestConstants::kRedPayloadType;
}
recv.sync_group = config.render.sync_group;
return recv;
@ -564,8 +571,8 @@ ReceiveVideoStream::ReceiveVideoStream(CallClient* receiver,
if (config.stream.use_flexfec) {
RTC_DCHECK(num_streams == 1);
FlexfecReceiveStream::Config flexfec(feedback_transport);
flexfec.payload_type = CallTest::kFlexfecPayloadType;
flexfec.rtp.remote_ssrc = CallTest::kFlexfecSendSsrc;
flexfec.payload_type = VideoTestConstants::kFlexfecPayloadType;
flexfec.rtp.remote_ssrc = VideoTestConstants::kFlexfecSendSsrc;
flexfec.protected_media_ssrcs = send_stream->rtx_ssrcs_;
flexfec.rtp.local_ssrc = recv_config.rtp.local_ssrc;
receiver_->ssrc_media_types_[flexfec.rtp.remote_ssrc] = MediaType::VIDEO;

60
third_party/libwebrtc/test/video_test_constants.h поставляемый Normal file
Просмотреть файл

@ -0,0 +1,60 @@
/*
* Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef TEST_VIDEO_TEST_CONSTANTS_H_
#define TEST_VIDEO_TEST_CONSTANTS_H_
#include <cstdint>
#include "api/units/time_delta.h"
namespace webrtc {
namespace test {
class VideoTestConstants {
public:
static constexpr size_t kNumSsrcs = 6;
static constexpr int kNumSimulcastStreams = 3;
static constexpr int kDefaultWidth = 320;
static constexpr int kDefaultHeight = 180;
static constexpr int kDefaultFramerate = 30;
static constexpr TimeDelta kDefaultTimeout = TimeDelta::Seconds(30);
static constexpr TimeDelta kLongTimeout = TimeDelta::Seconds(120);
enum classPayloadTypes : uint8_t {
kSendRtxPayloadType = 98,
kRtxRedPayloadType = 99,
kVideoSendPayloadType = 100,
kAudioSendPayloadType = 103,
kRedPayloadType = 118,
kUlpfecPayloadType = 119,
kFlexfecPayloadType = 120,
kPayloadTypeH264 = 122,
kPayloadTypeVP8 = 123,
kPayloadTypeVP9 = 124,
kPayloadTypeGeneric = 125,
kFakeVideoSendPayloadType = 126,
};
static constexpr uint32_t kSendRtxSsrcs[kNumSsrcs] = {
0xBADCAFD, 0xBADCAFE, 0xBADCAFF, 0xBADCB00, 0xBADCB01, 0xBADCB02};
static constexpr uint32_t kVideoSendSsrcs[kNumSsrcs] = {
0xC0FFED, 0xC0FFEE, 0xC0FFEF, 0xC0FFF0, 0xC0FFF1, 0xC0FFF2};
static constexpr uint32_t kAudioSendSsrc = 0xDEADBEEF;
static constexpr uint32_t kFlexfecSendSsrc = 0xBADBEEF;
static constexpr uint32_t kReceiverLocalVideoSsrc = 0x123456;
static constexpr uint32_t kReceiverLocalAudioSsrc = 0x1234567;
static constexpr int kNackRtpHistoryMs = 1000;
private:
VideoTestConstants() = default;
};
} // namespace test
} // namespace webrtc
#endif // TEST_VIDEO_TEST_CONSTANTS_H_

2
third_party/libwebrtc/video/BUILD.gn поставляемый
Просмотреть файл

@ -539,6 +539,7 @@ if (rtc_include_tests) {
"../test:test_support",
"../test:test_support_test_artifacts",
"../test:video_test_common",
"../test:video_test_constants",
"../test:video_test_support",
"config:streams_config",
]
@ -915,6 +916,7 @@ if (rtc_include_tests) {
"../test:test_common",
"../test:test_support",
"../test:video_test_common",
"../test:video_test_constants",
"../test/time_controller",
"adaptation:video_adaptation",
"config:encoder_config",

Просмотреть файл

@ -23,6 +23,7 @@
#include "test/field_trial.h"
#include "test/frame_generator_capturer.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
#include "video/config/video_encoder_config.h"
namespace webrtc {
@ -55,7 +56,9 @@ void CpuOveruseTest::RunTestAndCheckForAdaptation(
public:
OveruseObserver(const DegradationPreference& degradation_preference,
bool expect_adaptation)
: SendTest(expect_adaptation ? kLongTimeout : kDefaultTimeout),
: SendTest(expect_adaptation
? test::VideoTestConstants::kLongTimeout
: test::VideoTestConstants::kDefaultTimeout),
degradation_preference_(degradation_preference),
expect_adaptation_(expect_adaptation) {}

Просмотреть файл

@ -29,6 +29,7 @@
#include "test/rtcp_packet_parser.h"
#include "test/rtp_rtcp_observer.h"
#include "test/video_encoder_proxy_factory.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -46,7 +47,7 @@ class BandwidthEndToEndTest : public test::CallTest {
TEST_F(BandwidthEndToEndTest, ReceiveStreamSendsRemb) {
class RembObserver : public test::EndToEndTest {
public:
RembObserver() : EndToEndTest(kDefaultTimeout) {}
RembObserver() : EndToEndTest(test::VideoTestConstants::kDefaultTimeout) {}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
@ -62,10 +63,12 @@ TEST_F(BandwidthEndToEndTest, ReceiveStreamSendsRemb) {
EXPECT_TRUE(parser.Parse(packet, length));
if (parser.remb()->num_packets() > 0) {
EXPECT_EQ(kReceiverLocalVideoSsrc, parser.remb()->sender_ssrc());
EXPECT_EQ(test::VideoTestConstants::kReceiverLocalVideoSsrc,
parser.remb()->sender_ssrc());
EXPECT_LT(0U, parser.remb()->bitrate_bps());
EXPECT_EQ(1U, parser.remb()->ssrcs().size());
EXPECT_EQ(kVideoSendSsrcs[0], parser.remb()->ssrcs()[0]);
EXPECT_EQ(test::VideoTestConstants::kVideoSendSsrcs[0],
parser.remb()->ssrcs()[0]);
observation_complete_.Set();
}
@ -84,7 +87,7 @@ TEST_F(BandwidthEndToEndTest, ReceiveStreamSendsRemb) {
class BandwidthStatsTest : public test::EndToEndTest {
public:
BandwidthStatsTest(bool send_side_bwe, TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
sender_call_(nullptr),
receiver_call_(nullptr),
has_seen_pacer_delay_(false),
@ -191,7 +194,7 @@ TEST_F(BandwidthEndToEndTest, RembWithSendSideBwe) {
class BweObserver : public test::EndToEndTest {
public:
explicit BweObserver(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
sender_call_(nullptr),
clock_(Clock::GetRealTimeClock()),
sender_ssrc_(0),
@ -315,7 +318,7 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) {
public test::FakeEncoder {
public:
explicit EncoderRateStatsTest(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
task_queue_(task_queue),
send_stream_(nullptr),
@ -363,7 +366,7 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) {
}
void WaitForEncoderTargetBitrateMatchStats() {
for (int i = 0; i < kDefaultTimeout.ms(); ++i) {
for (int i = 0; i < test::VideoTestConstants::kDefaultTimeout.ms(); ++i) {
VideoSendStream::Stats stats = send_stream_->GetStats();
{
MutexLock lock(&mutex_);
@ -379,7 +382,7 @@ TEST_F(BandwidthEndToEndTest, ReportsSetEncoderRates) {
}
void WaitForStatsReportZeroTargetBitrate() {
for (int i = 0; i < kDefaultTimeout.ms(); ++i) {
for (int i = 0; i < test::VideoTestConstants::kDefaultTimeout.ms(); ++i) {
if (send_stream_->GetStats().target_media_bitrate_bps == 0) {
return;
}

Просмотреть файл

@ -22,6 +22,7 @@
#include "test/frame_forwarder.h"
#include "test/gtest.h"
#include "test/null_transport.h"
#include "test/video_test_constants.h"
namespace webrtc {
@ -88,7 +89,9 @@ TEST_F(CallOperationEndToEndTest, RendersSingleDelayedFrame) {
event_.Set();
}
bool Wait() { return event_.Wait(kDefaultTimeout); }
bool Wait() {
return event_.Wait(test::VideoTestConstants::kDefaultTimeout);
}
rtc::Event event_;
} renderer;
@ -143,7 +146,9 @@ TEST_F(CallOperationEndToEndTest, TransmitsFirstFrame) {
public:
void OnFrame(const VideoFrame& video_frame) override { event_.Set(); }
bool Wait() { return event_.Wait(kDefaultTimeout); }
bool Wait() {
return event_.Wait(test::VideoTestConstants::kDefaultTimeout);
}
rtc::Event event_;
} renderer;
@ -170,7 +175,9 @@ TEST_F(CallOperationEndToEndTest, TransmitsFirstFrame) {
Start();
frame_generator = test::CreateSquareFrameGenerator(
kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight, absl::nullopt,
absl::nullopt);
GetVideoSendStream()->SetSource(
&frame_forwarder, DegradationPreference::MAINTAIN_FRAMERATE);
test::FrameGeneratorInterface::VideoFrameData frame_data =

Просмотреть файл

@ -9,6 +9,7 @@
*/
#include <memory>
#include "absl/types/optional.h"
#include "api/test/video/function_video_encoder_factory.h"
#include "api/video/color_space.h"
@ -25,6 +26,7 @@
#include "test/encoder_settings.h"
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -53,7 +55,7 @@ class CodecObserver : public test::EndToEndTest,
const std::string& payload_name,
VideoEncoderFactory* encoder_factory,
VideoDecoderFactory* decoder_factory)
: EndToEndTest(4 * CodecEndToEndTest::kDefaultTimeout),
: EndToEndTest(4 * test::VideoTestConstants::kDefaultTimeout),
// TODO(hta): This timeout (120 seconds) is excessive.
// https://bugs.webrtc.org/6830
no_frames_to_wait_for_(no_frames_to_wait_for),
@ -76,7 +78,8 @@ class CodecObserver : public test::EndToEndTest,
encoder_config->codec_type = PayloadStringToCodecType(payload_name_);
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
(*receive_configs)[0].renderer = this;
(*receive_configs)[0].decoders.resize(1);

Просмотреть файл

@ -39,6 +39,7 @@
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/rtp_rtcp_observer.h"
#include "test/video_test_constants.h"
#include "video/config/video_encoder_config.h"
namespace webrtc {
@ -63,7 +64,7 @@ class RtcpXrObserver : public test::EndToEndTest {
bool expect_target_bitrate,
bool enable_zero_target_bitrate,
VideoEncoderConfig::ContentType content_type)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
enable_rrtr_(enable_rrtr),
expect_target_bitrate_(expect_target_bitrate),
enable_zero_target_bitrate_(enable_zero_target_bitrate),
@ -104,7 +105,7 @@ class RtcpXrObserver : public test::EndToEndTest {
test::RtcpPacketParser parser;
EXPECT_TRUE(parser.Parse(packet, length));
if (parser.sender_ssrc() == test::CallTest::kVideoSendSsrcs[1] &&
if (parser.sender_ssrc() == test::VideoTestConstants::kVideoSendSsrcs[1] &&
enable_zero_target_bitrate_) {
// Reduce bandwidth restriction to disable second stream after it was
// enabled for some time.

Просмотреть файл

@ -26,6 +26,7 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
using ::testing::Contains;
using ::testing::Not;
@ -53,7 +54,7 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
public rtc::VideoSinkInterface<VideoFrame> {
public:
UlpfecRenderObserver()
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_([]() { return VP8Encoder::Create(); }),
random_(0xcafef00d1),
num_packets_sent_(0) {}
@ -64,31 +65,38 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet, length));
EXPECT_TRUE(rtp_packet.PayloadType() == kVideoSendPayloadType ||
rtp_packet.PayloadType() == kRedPayloadType)
EXPECT_TRUE(rtp_packet.PayloadType() ==
test::VideoTestConstants::kVideoSendPayloadType ||
rtp_packet.PayloadType() ==
test::VideoTestConstants::kRedPayloadType)
<< "Unknown payload type received.";
EXPECT_EQ(kVideoSendSsrcs[0], rtp_packet.Ssrc())
EXPECT_EQ(test::VideoTestConstants::kVideoSendSsrcs[0], rtp_packet.Ssrc())
<< "Unknown SSRC received.";
// Parse RED header.
int encapsulated_payload_type = -1;
if (rtp_packet.PayloadType() == kRedPayloadType) {
if (rtp_packet.PayloadType() ==
test::VideoTestConstants::kRedPayloadType) {
encapsulated_payload_type = rtp_packet.payload()[0];
EXPECT_TRUE(encapsulated_payload_type == kVideoSendPayloadType ||
encapsulated_payload_type == kUlpfecPayloadType)
EXPECT_TRUE(encapsulated_payload_type ==
test::VideoTestConstants::kVideoSendPayloadType ||
encapsulated_payload_type ==
test::VideoTestConstants::kUlpfecPayloadType)
<< "Unknown encapsulated payload type received.";
}
// To minimize test flakiness, always let ULPFEC packets through.
if (encapsulated_payload_type == kUlpfecPayloadType) {
if (encapsulated_payload_type ==
test::VideoTestConstants::kUlpfecPayloadType) {
return SEND_PACKET;
}
// Simulate 5% video packet loss after rampup period. Record the
// corresponding timestamps that were dropped.
if (num_packets_sent_++ > 100 && random_.Rand(1, 100) <= 5) {
if (encapsulated_payload_type == kVideoSendPayloadType) {
if (encapsulated_payload_type ==
test::VideoTestConstants::kVideoSendPayloadType) {
dropped_sequence_numbers_.insert(rtp_packet.SequenceNumber());
dropped_timestamps_.insert(rtp_packet.Timestamp());
}
@ -116,7 +124,8 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
// in the packetization headers.
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = "VP8";
send_config->rtp.payload_type = kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
encoder_config->codec_type = kVideoCodecVP8;
VideoReceiveStreamInterface::Decoder decoder =
test::CreateMatchingDecoder(*send_config);
@ -125,10 +134,14 @@ TEST_F(FecEndToEndTest, ReceivesUlpfec) {
(*receive_configs)[0].decoders.push_back(decoder);
// Enable ULPFEC over RED.
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
(*receive_configs)[0].rtp.red_payload_type = kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
(*receive_configs)[0].rtp.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
(*receive_configs)[0].renderer = this;
}
@ -159,7 +172,7 @@ class FlexfecRenderObserver : public test::EndToEndTest,
static constexpr uint32_t kFlexfecLocalSsrc = 456;
explicit FlexfecRenderObserver(bool enable_nack, bool expect_flexfec_rtcp)
: test::EndToEndTest(test::CallTest::kLongTimeout),
: test::EndToEndTest(test::VideoTestConstants::kLongTimeout),
enable_nack_(enable_nack),
expect_flexfec_rtcp_(expect_flexfec_rtcp),
received_flexfec_rtcp_(false),
@ -175,27 +188,32 @@ class FlexfecRenderObserver : public test::EndToEndTest,
EXPECT_TRUE(rtp_packet.Parse(packet, length));
EXPECT_TRUE(
rtp_packet.PayloadType() == test::CallTest::kFakeVideoSendPayloadType ||
rtp_packet.PayloadType() == test::CallTest::kFlexfecPayloadType ||
(enable_nack_ &&
rtp_packet.PayloadType() == test::CallTest::kSendRtxPayloadType))
rtp_packet.PayloadType() ==
test::VideoTestConstants::kFakeVideoSendPayloadType ||
rtp_packet.PayloadType() ==
test::VideoTestConstants::kFlexfecPayloadType ||
(enable_nack_ && rtp_packet.PayloadType() ==
test::VideoTestConstants::kSendRtxPayloadType))
<< "Unknown payload type received.";
EXPECT_TRUE(
rtp_packet.Ssrc() == test::CallTest::kVideoSendSsrcs[0] ||
rtp_packet.Ssrc() == test::CallTest::kFlexfecSendSsrc ||
(enable_nack_ && rtp_packet.Ssrc() == test::CallTest::kSendRtxSsrcs[0]))
rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[0] ||
rtp_packet.Ssrc() == test::VideoTestConstants::kFlexfecSendSsrc ||
(enable_nack_ &&
rtp_packet.Ssrc() == test::VideoTestConstants::kSendRtxSsrcs[0]))
<< "Unknown SSRC received.";
// To reduce test flakiness, always let FlexFEC packets through.
if (rtp_packet.PayloadType() == test::CallTest::kFlexfecPayloadType) {
EXPECT_EQ(test::CallTest::kFlexfecSendSsrc, rtp_packet.Ssrc());
if (rtp_packet.PayloadType() ==
test::VideoTestConstants::kFlexfecPayloadType) {
EXPECT_EQ(test::VideoTestConstants::kFlexfecSendSsrc, rtp_packet.Ssrc());
return SEND_PACKET;
}
// To reduce test flakiness, always let RTX packets through.
if (rtp_packet.PayloadType() == test::CallTest::kSendRtxPayloadType) {
EXPECT_EQ(test::CallTest::kSendRtxSsrcs[0], rtp_packet.Ssrc());
if (rtp_packet.PayloadType() ==
test::VideoTestConstants::kSendRtxPayloadType) {
EXPECT_EQ(test::VideoTestConstants::kSendRtxSsrcs[0], rtp_packet.Ssrc());
if (rtp_packet.payload_size() == 0) {
// Pure padding packet.
@ -223,9 +241,10 @@ class FlexfecRenderObserver : public test::EndToEndTest,
// Simulate 5% video packet loss after rampup period. Record the
// corresponding timestamps that were dropped.
if (num_packets_sent_++ > 100 && random_.Rand(1, 100) <= 5) {
EXPECT_EQ(test::CallTest::kFakeVideoSendPayloadType,
EXPECT_EQ(test::VideoTestConstants::kFakeVideoSendPayloadType,
rtp_packet.PayloadType());
EXPECT_EQ(test::CallTest::kVideoSendSsrcs[0], rtp_packet.Ssrc());
EXPECT_EQ(test::VideoTestConstants::kVideoSendSsrcs[0],
rtp_packet.Ssrc());
dropped_sequence_numbers_.insert(rtp_packet.SequenceNumber());
dropped_timestamps_.insert(rtp_packet.Timestamp());
@ -246,7 +265,7 @@ class FlexfecRenderObserver : public test::EndToEndTest,
parser.receiver_report()->report_blocks();
if (!report_blocks.empty()) {
EXPECT_EQ(1U, report_blocks.size());
EXPECT_EQ(test::CallTest::kFlexfecSendSsrc,
EXPECT_EQ(test::VideoTestConstants::kFlexfecSendSsrc,
report_blocks[0].source_ssrc());
MutexLock lock(&mutex_);
received_flexfec_rtcp_ = true;
@ -286,17 +305,20 @@ class FlexfecRenderObserver : public test::EndToEndTest,
(*receive_configs)[0].renderer = this;
if (enable_nack_) {
send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
send_config->rtp.rtx.ssrcs.push_back(test::CallTest::kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::CallTest::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.rtx_ssrc = test::CallTest::kSendRtxSsrcs[0];
(*receive_configs)[0]
.rtp
.rtx_associated_payload_types[test::CallTest::kSendRtxPayloadType] =
test::CallTest::kVideoSendPayloadType;
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.rtx_ssrc =
test::VideoTestConstants::kSendRtxSsrcs[0];
(*receive_configs)[0].rtp.rtx_associated_payload_types
[test::VideoTestConstants::kSendRtxPayloadType] =
test::VideoTestConstants::kVideoSendPayloadType;
}
}
@ -345,7 +367,7 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
class UlpfecNackObserver : public test::EndToEndTest {
public:
UlpfecNackObserver()
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
state_(kFirstPacket),
ulpfec_sequence_number_(0),
has_last_sequence_number_(false),
@ -359,12 +381,16 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
EXPECT_TRUE(rtp_packet.Parse(packet, length));
int encapsulated_payload_type = -1;
if (rtp_packet.PayloadType() == kRedPayloadType) {
if (rtp_packet.PayloadType() ==
test::VideoTestConstants::kRedPayloadType) {
encapsulated_payload_type = rtp_packet.payload()[0];
if (encapsulated_payload_type != kFakeVideoSendPayloadType)
EXPECT_EQ(kUlpfecPayloadType, encapsulated_payload_type);
if (encapsulated_payload_type !=
test::VideoTestConstants::kFakeVideoSendPayloadType)
EXPECT_EQ(test::VideoTestConstants::kUlpfecPayloadType,
encapsulated_payload_type);
} else {
EXPECT_EQ(kFakeVideoSendPayloadType, rtp_packet.PayloadType());
EXPECT_EQ(test::VideoTestConstants::kFakeVideoSendPayloadType,
rtp_packet.PayloadType());
}
if (has_last_sequence_number_ &&
@ -376,7 +402,8 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
last_sequence_number_ = rtp_packet.SequenceNumber();
has_last_sequence_number_ = true;
bool ulpfec_packet = encapsulated_payload_type == kUlpfecPayloadType;
bool ulpfec_packet = encapsulated_payload_type ==
test::VideoTestConstants::kUlpfecPayloadType;
switch (state_) {
case kFirstPacket:
state_ = kDropEveryOtherPacketUntilUlpfec;
@ -454,18 +481,25 @@ TEST_F(FecEndToEndTest, ReceivedUlpfecPacketsNotNacked) {
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
// Configure hybrid NACK/FEC.
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
// Set codec to VP8, otherwise NACK/FEC hybrid will be disabled.
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = "VP8";
send_config->rtp.payload_type = kFakeVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kFakeVideoSendPayloadType;
encoder_config->codec_type = kVideoCodecVP8;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.red_payload_type = kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
(*receive_configs)[0].decoders.resize(1);
(*receive_configs)[0].decoders[0].payload_type =

Просмотреть файл

@ -15,6 +15,7 @@
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "test/call_test.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -29,7 +30,7 @@ class DecryptedFrameObserver : public test::EndToEndTest,
public rtc::VideoSinkInterface<VideoFrame> {
public:
DecryptedFrameObserver()
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_([] { return VP8Encoder::Create(); }) {}
private:
@ -40,7 +41,8 @@ class DecryptedFrameObserver : public test::EndToEndTest,
// Use VP8 instead of FAKE.
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = "VP8";
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
send_config->frame_encryptor = new FakeFrameEncryptor();
send_config->crypto_options.sframe.require_frame_encryption = true;
encoder_config->codec_type = kVideoCodecVP8;

Просмотреть файл

@ -15,6 +15,7 @@
#include "system_wrappers/include/metrics.h"
#include "test/call_test.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -44,7 +45,7 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
public rtc::VideoSinkInterface<VideoFrame> {
public:
FrameObserver(bool use_rtx, bool use_fec, bool screenshare)
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
use_rtx_(use_rtx),
use_fec_(use_fec),
screenshare_(screenshare),
@ -92,33 +93,43 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
// NACK
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].renderer = this;
// FEC
if (use_fec_) {
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = "VP8";
encoder_config->codec_type = kVideoCodecVP8;
(*receive_configs)[0].decoders[0].video_format = SdpVideoFormat("VP8");
(*receive_configs)[0].rtp.red_payload_type = kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
(*receive_configs)[0].rtp.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
}
// RTX
if (use_rtx_) {
send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type = kSendRtxPayloadType;
(*receive_configs)[0].rtp.rtx_ssrc = kSendRtxSsrcs[0];
(*receive_configs)[0]
.rtp.rtx_associated_payload_types[kSendRtxPayloadType] =
kFakeVideoSendPayloadType;
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
(*receive_configs)[0].rtp.rtx_ssrc =
test::VideoTestConstants::kSendRtxSsrcs[0];
(*receive_configs)[0].rtp.rtx_associated_payload_types
[test::VideoTestConstants::kSendRtxPayloadType] =
test::VideoTestConstants::kFakeVideoSendPayloadType;
if (use_fec_) {
send_config->rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType;
(*receive_configs)[0]
.rtp.rtx_associated_payload_types[kRtxRedPayloadType] =
kSendRtxPayloadType;
send_config->rtp.ulpfec.red_rtx_payload_type =
test::VideoTestConstants::kRtxRedPayloadType;
(*receive_configs)[0].rtp.rtx_associated_payload_types
[test::VideoTestConstants::kRtxRedPayloadType] =
test::VideoTestConstants::kSendRtxPayloadType;
}
}
// RTT needed for RemoteNtpTimeEstimator for the receive stream.
@ -201,19 +212,24 @@ void HistogramTest::VerifyHistogramStats(bool use_rtx,
EXPECT_METRIC_EQ(
1, metrics::NumSamples(video_prefix + "ReceivedHeightInPixels"));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "InputWidthInPixels",
kDefaultWidth));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "InputHeightInPixels",
kDefaultHeight));
EXPECT_METRIC_EQ(
1, metrics::NumEvents(video_prefix + "SentWidthInPixels", kDefaultWidth));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "SentHeightInPixels",
kDefaultHeight));
EXPECT_METRIC_EQ(1, metrics::NumEvents(video_prefix + "ReceivedWidthInPixels",
kDefaultWidth));
EXPECT_METRIC_EQ(1,
metrics::NumEvents(video_prefix + "ReceivedHeightInPixels",
kDefaultHeight));
metrics::NumEvents(video_prefix + "InputWidthInPixels",
test::VideoTestConstants::kDefaultWidth));
EXPECT_METRIC_EQ(
1, metrics::NumEvents(video_prefix + "InputHeightInPixels",
test::VideoTestConstants::kDefaultHeight));
EXPECT_METRIC_EQ(1,
metrics::NumEvents(video_prefix + "SentWidthInPixels",
test::VideoTestConstants::kDefaultWidth));
EXPECT_METRIC_EQ(
1, metrics::NumEvents(video_prefix + "SentHeightInPixels",
test::VideoTestConstants::kDefaultHeight));
EXPECT_METRIC_EQ(1,
metrics::NumEvents(video_prefix + "ReceivedWidthInPixels",
test::VideoTestConstants::kDefaultWidth));
EXPECT_METRIC_EQ(
1, metrics::NumEvents(video_prefix + "ReceivedHeightInPixels",
test::VideoTestConstants::kDefaultHeight));
EXPECT_METRIC_EQ(1,
metrics::NumSamples(video_prefix + "InputFramesPerSecond"));

Просмотреть файл

@ -24,6 +24,7 @@
#include "test/call_test.h"
#include "test/gmock.h"
#include "test/gtest.h"
#include "test/video_test_constants.h"
using ::testing::Contains;
@ -36,11 +37,11 @@ constexpr int kFramesToObserve = 10;
uint8_t PayloadNameToPayloadType(const std::string& payload_name) {
if (payload_name == "VP8") {
return test::CallTest::kPayloadTypeVP8;
return test::VideoTestConstants::kPayloadTypeVP8;
} else if (payload_name == "VP9") {
return test::CallTest::kPayloadTypeVP9;
return test::VideoTestConstants::kPayloadTypeVP9;
} else if (payload_name == "H264") {
return test::CallTest::kPayloadTypeH264;
return test::VideoTestConstants::kPayloadTypeH264;
} else {
RTC_DCHECK_NOTREACHED();
return 0;
@ -63,7 +64,8 @@ int RemoveOlderOrEqual(uint32_t timestamp, std::vector<uint32_t>* timestamps) {
class FrameObserver : public test::RtpRtcpObserver,
public rtc::VideoSinkInterface<VideoFrame> {
public:
FrameObserver() : test::RtpRtcpObserver(test::CallTest::kDefaultTimeout) {}
FrameObserver()
: test::RtpRtcpObserver(test::VideoTestConstants::kDefaultTimeout) {}
void Reset(uint8_t expected_payload_type) {
MutexLock lock(&mutex_);
@ -79,7 +81,7 @@ class FrameObserver : public test::RtpRtcpObserver,
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet, length));
EXPECT_EQ(rtp_packet.Ssrc(), test::CallTest::kVideoSendSsrcs[0]);
EXPECT_EQ(rtp_packet.Ssrc(), test::VideoTestConstants::kVideoSendSsrcs[0]);
if (rtp_packet.payload_size() == 0)
return SEND_PACKET; // Skip padding, may be sent after OnFrame is called.

Просмотреть файл

@ -29,6 +29,7 @@
#include "rtc_base/task_queue_for_test.h"
#include "test/call_test.h"
#include "test/encoder_settings.h"
#include "test/video_test_constants.h"
namespace webrtc {
@ -101,7 +102,8 @@ void MultiStreamTester::RunTest() {
VideoReceiveStreamInterface::Config receive_config(
receiver_transport.get());
receive_config.rtp.remote_ssrc = ssrc;
receive_config.rtp.local_ssrc = test::CallTest::kReceiverLocalVideoSsrc;
receive_config.rtp.local_ssrc =
test::VideoTestConstants::kReceiverLocalVideoSsrc;
receive_config.decoder_factory = &decoder_factory;
VideoReceiveStreamInterface::Decoder decoder =
test::CreateMatchingDecoder(send_config);

Просмотреть файл

@ -104,8 +104,10 @@ void NetworkStateEndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState(
GetVideoSendConfig()->encoder_settings.encoder_factory =
&encoder_factory;
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(
test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
Start();
});
@ -131,8 +133,9 @@ void NetworkStateEndToEndTest::VerifyNewVideoReceiveStreamsRespectNetworkState(
CreateSendConfig(1, 0, 0);
CreateMatchingReceiveConfigs(transport);
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
Start();
});
@ -158,7 +161,7 @@ TEST_F(NetworkStateEndToEndTest, RespectsNetworkState) {
class NetworkStateTest : public test::EndToEndTest, public test::FakeEncoder {
public:
explicit NetworkStateTest(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
e2e_test_task_queue_(task_queue),
task_queue_(CreateDefaultTaskQueueFactory()->CreateTaskQueue(
@ -225,7 +228,8 @@ TEST_F(NetworkStateEndToEndTest, RespectsNetworkState) {
}
void PerformTest() override {
EXPECT_TRUE(encoded_frames_.Wait(kDefaultTimeout))
EXPECT_TRUE(
encoded_frames_.Wait(test::VideoTestConstants::kDefaultTimeout))
<< "No frames received by the encoder.";
SendTask(task_queue_.get(), [this]() {

Просмотреть файл

@ -18,6 +18,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/video_encoder_proxy_factory.h"
#include "test/video_test_constants.h"
#include "video/config/encoder_stream_factory.h"
namespace webrtc {
@ -119,7 +120,7 @@ class InitEncodeTest : public test::EndToEndTest,
InitEncodeTest(const std::string& payload_name,
const std::vector<TestConfig>& configs,
const std::vector<Expectation>& expectations)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
encoder_factory_(this),
payload_name_(payload_name),
@ -147,7 +148,8 @@ class InitEncodeTest : public test::EndToEndTest,
webrtc::VideoEncoder::EncoderInfo encoder_info;
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
const VideoCodecType codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->codec_type = codec_type;
encoder_config->video_stream_factory =

Просмотреть файл

@ -26,6 +26,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -53,7 +54,7 @@ TEST_F(RetransmissionEndToEndTest, ReceivesAndRetransmitsNack) {
class NackObserver : public test::EndToEndTest {
public:
NackObserver()
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
sent_rtp_packets_(0),
packets_left_to_drop_(0),
nacks_left_(kNumberOfNacksToObserve) {}
@ -108,8 +109,10 @@ TEST_F(RetransmissionEndToEndTest, ReceivesAndRetransmitsNack) {
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
}
void PerformTest() override {
@ -133,7 +136,7 @@ TEST_F(RetransmissionEndToEndTest, ReceivesNackAndRetransmitsAudio) {
class NackObserver : public test::EndToEndTest {
public:
NackObserver()
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
local_ssrc_(0),
remote_ssrc_(0),
receive_transport_(nullptr) {}
@ -172,7 +175,8 @@ TEST_F(RetransmissionEndToEndTest, ReceivesNackAndRetransmitsAudio) {
void ModifyAudioConfigs(AudioSendStream::Config* send_config,
std::vector<AudioReceiveStreamInterface::Config>*
receive_configs) override {
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
local_ssrc_ = (*receive_configs)[0].rtp.local_ssrc;
remote_ssrc_ = (*receive_configs)[0].rtp.remote_ssrc;
receive_transport_ = (*receive_configs)[0].rtcp_send_transport;
@ -272,7 +276,7 @@ void RetransmissionEndToEndTest::ReceivesPliAndRecovers(int rtp_history_ms) {
public rtc::VideoSinkInterface<VideoFrame> {
public:
explicit PliObserver(int rtp_history_ms)
: EndToEndTest(kLongTimeout),
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
rtp_history_ms_(rtp_history_ms),
nack_enabled_(rtp_history_ms > 0),
highest_dropped_timestamp_(0),
@ -362,10 +366,11 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
public rtc::VideoSinkInterface<VideoFrame> {
public:
RetransmissionObserver(bool enable_rtx, bool enable_red)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
payload_type_(GetPayloadType(false, enable_red)),
retransmission_ssrc_(enable_rtx ? kSendRtxSsrcs[0]
: kVideoSendSsrcs[0]),
retransmission_ssrc_(
enable_rtx ? test::VideoTestConstants::kSendRtxSsrcs[0]
: test::VideoTestConstants::kVideoSendSsrcs[0]),
retransmission_payload_type_(GetPayloadType(enable_rtx, enable_red)),
encoder_factory_([]() { return VP8Encoder::Create(); }),
marker_bits_observed_(0),
@ -417,7 +422,8 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
// Insert ourselves into the rendering pipeline.
RTC_DCHECK(!orig_renderer_);
@ -427,27 +433,34 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
(*receive_configs)[0].enable_prerenderer_smoothing = false;
(*receive_configs)[0].renderer = this;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
if (payload_type_ == kRedPayloadType) {
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
if (retransmission_ssrc_ == kSendRtxSsrcs[0])
send_config->rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType;
if (payload_type_ == test::VideoTestConstants::kRedPayloadType) {
send_config->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
if (retransmission_ssrc_ == test::VideoTestConstants::kSendRtxSsrcs[0])
send_config->rtp.ulpfec.red_rtx_payload_type =
test::VideoTestConstants::kRtxRedPayloadType;
(*receive_configs)[0].rtp.ulpfec_payload_type =
send_config->rtp.ulpfec.ulpfec_payload_type;
(*receive_configs)[0].rtp.red_payload_type =
send_config->rtp.ulpfec.red_payload_type;
}
if (retransmission_ssrc_ == kSendRtxSsrcs[0]) {
send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type = kSendRtxPayloadType;
(*receive_configs)[0].rtp.rtx_ssrc = kSendRtxSsrcs[0];
(*receive_configs)[0]
.rtp.rtx_associated_payload_types[(payload_type_ == kRedPayloadType)
? kRtxRedPayloadType
: kSendRtxPayloadType] =
if (retransmission_ssrc_ == test::VideoTestConstants::kSendRtxSsrcs[0]) {
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
(*receive_configs)[0].rtp.rtx_ssrc =
test::VideoTestConstants::kSendRtxSsrcs[0];
(*receive_configs)[0].rtp.rtx_associated_payload_types
[(payload_type_ == test::VideoTestConstants::kRedPayloadType)
? test::VideoTestConstants::kRtxRedPayloadType
: test::VideoTestConstants::kSendRtxPayloadType] =
payload_type_;
}
// Configure encoding and decoding with VP8, since generic packetization
@ -472,12 +485,12 @@ void RetransmissionEndToEndTest::DecodesRetransmittedFrame(bool enable_rtx,
int GetPayloadType(bool use_rtx, bool use_fec) {
if (use_fec) {
if (use_rtx)
return kRtxRedPayloadType;
return kRedPayloadType;
return test::VideoTestConstants::kRtxRedPayloadType;
return test::VideoTestConstants::kRedPayloadType;
}
if (use_rtx)
return kSendRtxPayloadType;
return kFakeVideoSendPayloadType;
return test::VideoTestConstants::kSendRtxPayloadType;
return test::VideoTestConstants::kFakeVideoSendPayloadType;
}
Mutex mutex_;

Просмотреть файл

@ -22,6 +22,7 @@
#include "test/call_test.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -41,7 +42,7 @@ void RtpRtcpEndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) {
class RtcpModeObserver : public test::EndToEndTest {
public:
explicit RtcpModeObserver(RtcpMode rtcp_mode)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
rtcp_mode_(rtcp_mode),
sent_rtp_(0),
sent_rtcp_(0) {}
@ -94,8 +95,10 @@ void RtpRtcpEndToEndTest::RespectsRtcpMode(RtcpMode rtcp_mode) {
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.rtcp_mode = rtcp_mode_;
}
@ -168,12 +171,13 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
class RtpSequenceObserver : public test::RtpRtcpObserver {
public:
explicit RtpSequenceObserver(bool use_rtx)
: test::RtpRtcpObserver(kDefaultTimeout),
ssrcs_to_observe_(kNumSimulcastStreams) {
for (size_t i = 0; i < kNumSimulcastStreams; ++i) {
ssrc_is_rtx_[kVideoSendSsrcs[i]] = false;
: test::RtpRtcpObserver(test::VideoTestConstants::kDefaultTimeout),
ssrcs_to_observe_(test::VideoTestConstants::kNumSimulcastStreams) {
for (size_t i = 0; i < test::VideoTestConstants::kNumSimulcastStreams;
++i) {
ssrc_is_rtx_[test::VideoTestConstants::kVideoSendSsrcs[i]] = false;
if (use_rtx)
ssrc_is_rtx_[kSendRtxSsrcs[i]] = true;
ssrc_is_rtx_[test::VideoTestConstants::kSendRtxSsrcs[i]] = true;
}
}
@ -188,7 +192,8 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
uint32_t timestamp,
bool only_padding)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_) {
static const int32_t kMaxTimestampGap = kDefaultTimeout.ms() * 90;
static const int32_t kMaxTimestampGap =
test::VideoTestConstants::kDefaultTimeout.ms() * 90;
auto timestamp_it = last_observed_timestamp_.find(ssrc);
if (timestamp_it == last_observed_timestamp_.end()) {
EXPECT_FALSE(only_padding);
@ -285,13 +290,16 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
CreateCalls();
CreateSendTransport(BuiltInNetworkBehaviorConfig(), &observer);
CreateReceiveTransport(BuiltInNetworkBehaviorConfig(), &observer);
CreateSendConfig(kNumSimulcastStreams, 0, 0);
CreateSendConfig(test::VideoTestConstants::kNumSimulcastStreams, 0, 0);
if (use_rtx) {
for (size_t i = 0; i < kNumSimulcastStreams; ++i) {
GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
for (size_t i = 0; i < test::VideoTestConstants::kNumSimulcastStreams;
++i) {
GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[i]);
}
GetVideoSendConfig()->rtp.rtx.payload_type = kSendRtxPayloadType;
GetVideoSendConfig()->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
}
GetVideoEncoderConfig()->video_stream_factory =
@ -341,7 +349,7 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
GetVideoSendStream()->ReconfigureVideoEncoder(
GetVideoEncoderConfig()->Copy());
});
observer.ResetExpectedSsrcs(kNumSimulcastStreams);
observer.ResetExpectedSsrcs(test::VideoTestConstants::kNumSimulcastStreams);
EXPECT_TRUE(observer.Wait())
<< "Timed out waiting for all SSRCs to send packets.";
@ -357,7 +365,7 @@ void RtpRtcpEndToEndTest::TestRtpStatePreservation(
GetVideoSendStream()->ReconfigureVideoEncoder(
GetVideoEncoderConfig()->Copy());
});
observer.ResetExpectedSsrcs(kNumSimulcastStreams);
observer.ResetExpectedSsrcs(test::VideoTestConstants::kNumSimulcastStreams);
EXPECT_TRUE(observer.Wait())
<< "Timed out waiting for all SSRCs to send packets.";
}
@ -387,7 +395,7 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
class RtpSequenceObserver : public test::RtpRtcpObserver {
public:
RtpSequenceObserver()
: test::RtpRtcpObserver(kDefaultTimeout),
: test::RtpRtcpObserver(test::VideoTestConstants::kDefaultTimeout),
num_flexfec_packets_sent_(0) {}
void ResetPacketCount() {
@ -405,10 +413,12 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
const uint32_t timestamp = rtp_packet.Timestamp();
const uint32_t ssrc = rtp_packet.Ssrc();
if (ssrc == kVideoSendSsrcs[0] || ssrc == kSendRtxSsrcs[0]) {
if (ssrc == test::VideoTestConstants::kVideoSendSsrcs[0] ||
ssrc == test::VideoTestConstants::kSendRtxSsrcs[0]) {
return SEND_PACKET;
}
EXPECT_EQ(kFlexfecSendSsrc, ssrc) << "Unknown SSRC sent.";
EXPECT_EQ(test::VideoTestConstants::kFlexfecSendSsrc, ssrc)
<< "Unknown SSRC sent.";
++num_flexfec_packets_sent_;
@ -476,18 +486,24 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
GetVideoSendConfig()->rtp.payload_name = "VP8";
GetVideoSendConfig()->rtp.payload_type = kVideoSendPayloadType;
GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
GetVideoSendConfig()->rtp.rtx.payload_type = kSendRtxPayloadType;
GetVideoSendConfig()->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
GetVideoSendConfig()->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
GetVideoSendConfig()->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[0]);
GetVideoSendConfig()->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
GetVideoEncoderConfig()->codec_type = kVideoCodecVP8;
CreateMatchingReceiveConfigs();
video_receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
video_receive_configs_[0].rtp.rtx_ssrc = kSendRtxSsrcs[0];
video_receive_configs_[0]
.rtp.rtx_associated_payload_types[kSendRtxPayloadType] =
kVideoSendPayloadType;
video_receive_configs_[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
video_receive_configs_[0].rtp.rtx_ssrc =
test::VideoTestConstants::kSendRtxSsrcs[0];
video_receive_configs_[0].rtp.rtx_associated_payload_types
[test::VideoTestConstants::kSendRtxPayloadType] =
test::VideoTestConstants::kVideoSendPayloadType;
// The matching FlexFEC receive config is not created by
// CreateMatchingReceiveConfigs since this is not a test::BaseTest.
@ -500,7 +516,8 @@ TEST_F(RtpRtcpEndToEndTest, DISABLED_TestFlexfecRtpStatePreservation) {
GetVideoSendConfig()->rtp.flexfec.ssrc;
flexfec_receive_config.protected_media_ssrcs =
GetVideoSendConfig()->rtp.flexfec.protected_media_ssrcs;
flexfec_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
flexfec_receive_config.rtp.local_ssrc =
test::VideoTestConstants::kReceiverLocalVideoSsrc;
flexfec_receive_configs_.push_back(flexfec_receive_config);
CreateFlexfecStreams();

Просмотреть файл

@ -21,6 +21,7 @@
#include "test/call_test.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
namespace webrtc {
class SsrcEndToEndTest : public test::CallTest {
@ -37,12 +38,14 @@ class SsrcEndToEndTest : public test::CallTest {
TEST_F(SsrcEndToEndTest, ReceiverUsesLocalSsrc) {
class SyncRtcpObserver : public test::EndToEndTest {
public:
SyncRtcpObserver() : EndToEndTest(kDefaultTimeout) {}
SyncRtcpObserver()
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout) {}
Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
test::RtcpPacketParser parser;
EXPECT_TRUE(parser.Parse(packet, length));
EXPECT_EQ(kReceiverLocalVideoSsrc, parser.sender_ssrc());
EXPECT_EQ(test::VideoTestConstants::kReceiverLocalVideoSsrc,
parser.sender_ssrc());
observation_complete_.Set();
return SEND_PACKET;
@ -64,7 +67,8 @@ TEST_F(SsrcEndToEndTest, UnknownRtpPacketTriggersUndemuxablePacketHandler) {
: receiver_(receiver) {}
bool Wait() {
return undemuxable_packet_handler_triggered_.Wait(kDefaultTimeout);
return undemuxable_packet_handler_triggered_.Wait(
test::VideoTestConstants::kDefaultTimeout);
}
private:
@ -119,8 +123,10 @@ TEST_F(SsrcEndToEndTest, UnknownRtpPacketTriggersUndemuxablePacketHandler) {
CreateMatchingReceiveConfigs(receive_transport.get());
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(
test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
Start();
receiver_call_->DestroyVideoReceiveStream(video_receive_streams_[0]);
@ -147,7 +153,7 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
size_t num_ssrcs,
bool send_single_ssrc_first,
TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
num_ssrcs_(num_ssrcs),
send_single_ssrc_first_(send_single_ssrc_first),
ssrcs_to_observe_(num_ssrcs),
@ -236,7 +242,8 @@ void SsrcEndToEndTest::TestSendsSetSsrcs(size_t num_ssrcs,
VideoSendStream* send_stream_;
VideoEncoderConfig video_encoder_config_all_streams_;
TaskQueueBase* task_queue_;
} test(kVideoSendSsrcs, num_ssrcs, send_single_ssrc_first, task_queue());
} test(test::VideoTestConstants::kVideoSendSsrcs, num_ssrcs,
send_single_ssrc_first, task_queue());
RunBaseTest(&test);
}
@ -246,21 +253,22 @@ TEST_F(SsrcEndToEndTest, SendsSetSsrc) {
}
TEST_F(SsrcEndToEndTest, SendsSetSimulcastSsrcs) {
TestSendsSetSsrcs(kNumSimulcastStreams, false);
TestSendsSetSsrcs(test::VideoTestConstants::kNumSimulcastStreams, false);
}
TEST_F(SsrcEndToEndTest, CanSwitchToUseAllSsrcs) {
TestSendsSetSsrcs(kNumSimulcastStreams, true);
TestSendsSetSsrcs(test::VideoTestConstants::kNumSimulcastStreams, true);
}
TEST_F(SsrcEndToEndTest, DISABLED_RedundantPayloadsTransmittedOnAllSsrcs) {
class ObserveRedundantPayloads : public test::EndToEndTest {
public:
ObserveRedundantPayloads()
: EndToEndTest(kDefaultTimeout),
ssrcs_to_observe_(kNumSimulcastStreams) {
for (size_t i = 0; i < kNumSimulcastStreams; ++i) {
registered_rtx_ssrc_[kSendRtxSsrcs[i]] = true;
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
ssrcs_to_observe_(test::VideoTestConstants::kNumSimulcastStreams) {
for (size_t i = 0; i < test::VideoTestConstants::kNumSimulcastStreams;
++i) {
registered_rtx_ssrc_[test::VideoTestConstants::kSendRtxSsrcs[i]] = true;
}
}
@ -286,7 +294,9 @@ TEST_F(SsrcEndToEndTest, DISABLED_RedundantPayloadsTransmittedOnAllSsrcs) {
return SEND_PACKET;
}
size_t GetNumVideoStreams() const override { return kNumSimulcastStreams; }
size_t GetNumVideoStreams() const override {
return test::VideoTestConstants::kNumSimulcastStreams;
}
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
@ -299,10 +309,13 @@ TEST_F(SsrcEndToEndTest, DISABLED_RedundantPayloadsTransmittedOnAllSsrcs) {
layer.target_bitrate_bps = 15000;
layer.max_bitrate_bps = 20000;
}
send_config->rtp.rtx.payload_type = kSendRtxPayloadType;
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
for (size_t i = 0; i < kNumSimulcastStreams; ++i)
send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
for (size_t i = 0; i < test::VideoTestConstants::kNumSimulcastStreams;
++i)
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[i]);
// Significantly higher than max bitrates for all video streams -> forcing
// padding to trigger redundant padding on all RTX SSRCs.

Просмотреть файл

@ -28,6 +28,7 @@
#include "test/fake_encoder.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -51,7 +52,8 @@ TEST_F(StatsEndToEndTest, GetStats) {
class StatsObserver : public test::EndToEndTest {
public:
StatsObserver()
: EndToEndTest(kLongTimeout), encoder_factory_([]() {
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
encoder_factory_([]() {
return std::make_unique<test::DelayedEncoder>(
Clock::GetRealTimeClock(), 10);
}) {}
@ -135,9 +137,11 @@ TEST_F(StatsEndToEndTest, GetStats) {
stats.rtcp_packet_type_counts.unique_nack_requests != 0;
RTC_DCHECK(stats.current_payload_type == -1 ||
stats.current_payload_type == kFakeVideoSendPayloadType);
stats.current_payload_type ==
test::VideoTestConstants::kFakeVideoSendPayloadType);
receive_stats_filled_["IncomingPayloadType"] |=
stats.current_payload_type == kFakeVideoSendPayloadType;
stats.current_payload_type ==
test::VideoTestConstants::kFakeVideoSendPayloadType;
}
return AllStatsFilled(receive_stats_filled_);
@ -150,7 +154,8 @@ TEST_F(StatsEndToEndTest, GetStats) {
SendTask(task_queue_, [&]() { stats = send_stream_->GetStats(); });
size_t expected_num_streams =
kNumSimulcastStreams + expected_send_ssrcs_.size();
test::VideoTestConstants::kNumSimulcastStreams +
expected_send_ssrcs_.size();
send_stats_filled_["NumStreams"] |=
stats.substreams.size() == expected_num_streams;
@ -252,8 +257,10 @@ TEST_F(StatsEndToEndTest, GetStats) {
}
send_config->rtp.c_name = "SomeCName";
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.rtx.payload_type = kSendRtxPayloadType;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs;
for (size_t i = 0; i < ssrcs.size(); ++i) {
@ -261,23 +268,29 @@ TEST_F(StatsEndToEndTest, GetStats) {
expected_receive_ssrcs_.push_back(
(*receive_configs)[i].rtp.remote_ssrc);
(*receive_configs)[i].render_delay_ms = kExpectedRenderDelayMs;
(*receive_configs)[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[i].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[i].rtp.rtx_ssrc = kSendRtxSsrcs[i];
(*receive_configs)[i]
.rtp.rtx_associated_payload_types[kSendRtxPayloadType] =
kFakeVideoSendPayloadType;
(*receive_configs)[i].rtp.rtx_ssrc =
test::VideoTestConstants::kSendRtxSsrcs[i];
(*receive_configs)[i].rtp.rtx_associated_payload_types
[test::VideoTestConstants::kSendRtxPayloadType] =
test::VideoTestConstants::kFakeVideoSendPayloadType;
}
for (size_t i = 0; i < kNumSimulcastStreams; ++i)
send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[i]);
for (size_t i = 0; i < test::VideoTestConstants::kNumSimulcastStreams;
++i)
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[i]);
// Use a delayed encoder to make sure we see CpuOveruseMetrics stats that
// are non-zero.
send_config->encoder_settings.encoder_factory = &encoder_factory_;
}
size_t GetNumVideoStreams() const override { return kNumSimulcastStreams; }
size_t GetNumVideoStreams() const override {
return test::VideoTestConstants::kNumSimulcastStreams;
}
void OnVideoStreamsCreated(VideoSendStream* send_stream,
const std::vector<VideoReceiveStreamInterface*>&
@ -290,7 +303,8 @@ TEST_F(StatsEndToEndTest, GetStats) {
void PerformTest() override {
Clock* clock = Clock::GetRealTimeClock();
int64_t now_ms = clock->TimeInMilliseconds();
int64_t stop_time_ms = now_ms + test::CallTest::kLongTimeout.ms();
int64_t stop_time_ms =
now_ms + test::VideoTestConstants::kLongTimeout.ms();
bool receive_ok = false;
bool send_ok = false;
@ -347,7 +361,7 @@ TEST_F(StatsEndToEndTest, TimingFramesAreReported) {
class StatsObserver : public test::EndToEndTest {
public:
StatsObserver() : EndToEndTest(kLongTimeout) {}
StatsObserver() : EndToEndTest(test::VideoTestConstants::kLongTimeout) {}
private:
void ModifyVideoConfigs(
@ -395,7 +409,8 @@ TEST_F(StatsEndToEndTest, TestReceivedRtpPacketStats) {
class ReceivedRtpStatsObserver : public test::EndToEndTest {
public:
explicit ReceivedRtpStatsObserver(TaskQueueBase* task_queue)
: EndToEndTest(kDefaultTimeout), task_queue_(task_queue) {}
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue) {}
private:
void OnVideoStreamsCreated(VideoSendStream* send_stream,
@ -447,7 +462,9 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
class StatsObserver : public test::BaseTest,
public rtc::VideoSinkInterface<VideoFrame> {
public:
StatsObserver() : BaseTest(kLongTimeout), num_frames_received_(0) {}
StatsObserver()
: BaseTest(test::VideoTestConstants::kLongTimeout),
num_frames_received_(0) {}
bool ShouldCreateReceivers() const override { return true; }
@ -512,8 +529,10 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
CreateMatchingReceiveConfigs();
// Modify send and receive configs.
GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
video_receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
GetVideoSendConfig()->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
video_receive_configs_[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
video_receive_configs_[0].renderer = &test;
// RTT needed for RemoteNtpTimeEstimator for the receive stream.
video_receive_configs_[0].rtp.rtcp_xr.receiver_reference_time_report =
@ -527,8 +546,10 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
VideoEncoderConfig::ContentType::kScreen;
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(
test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
Start();
});
@ -572,7 +593,8 @@ TEST_F(StatsEndToEndTest, VerifyNackStats) {
class NackObserver : public test::EndToEndTest {
public:
explicit NackObserver(TaskQueueBase* task_queue)
: EndToEndTest(kLongTimeout), task_queue_(task_queue) {}
: EndToEndTest(test::VideoTestConstants::kLongTimeout),
task_queue_(task_queue) {}
private:
Action OnSendRtp(const uint8_t* packet, size_t length) override {
@ -638,8 +660,10 @@ TEST_F(StatsEndToEndTest, VerifyNackStats) {
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
(*receive_configs)[0].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
}
void OnVideoStreamsCreated(VideoSendStream* send_stream,
@ -695,8 +719,9 @@ TEST_F(StatsEndToEndTest, CallReportsRttForSender) {
CreateMatchingReceiveConfigs();
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
receiver_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp);
Start();
});
@ -706,7 +731,7 @@ TEST_F(StatsEndToEndTest, CallReportsRttForSender) {
Call::Stats stats;
SendTask(task_queue(),
[this, &stats]() { stats = sender_call_->GetStats(); });
ASSERT_GE(start_time_ms + kDefaultTimeout.ms(),
ASSERT_GE(start_time_ms + test::VideoTestConstants::kDefaultTimeout.ms(),
clock_->TimeInMilliseconds())
<< "No RTT stats before timeout!";
if (stats.rtt_ms != -1) {

Просмотреть файл

@ -26,6 +26,7 @@
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/rtcp_packet_parser.h"
#include "test/video_test_constants.h"
#include "video/end_to_end_tests/multi_stream_tester.h"
namespace webrtc {
@ -251,7 +252,7 @@ class TransportFeedbackEndToEndTest : public test::CallTest {
class TransportFeedbackTester : public test::EndToEndTest {
public:
TransportFeedbackTester(size_t num_video_streams, size_t num_audio_streams)
: EndToEndTest(::webrtc::TransportFeedbackEndToEndTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
num_video_streams_(num_video_streams),
num_audio_streams_(num_audio_streams),
receiver_call_(nullptr) {
@ -279,7 +280,8 @@ class TransportFeedbackTester : public test::EndToEndTest {
}
void PerformTest() override {
EXPECT_TRUE(observation_complete_.Wait(test::CallTest::kDefaultTimeout));
EXPECT_TRUE(
observation_complete_.Wait(test::VideoTestConstants::kDefaultTimeout));
}
void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
@ -326,8 +328,7 @@ TEST_F(TransportFeedbackEndToEndTest,
class TransportFeedbackTester : public test::EndToEndTest {
public:
TransportFeedbackTester(size_t num_video_streams, size_t num_audio_streams)
: EndToEndTest(
::webrtc::TransportFeedbackEndToEndTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
num_video_streams_(num_video_streams),
num_audio_streams_(num_audio_streams),
media_sent_(0),
@ -415,7 +416,7 @@ TEST_F(TransportFeedbackEndToEndTest, TransportSeqNumOnAudioAndVideo) {
class TransportSequenceNumberTest : public test::EndToEndTest {
public:
TransportSequenceNumberTest()
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
video_observed_(false),
audio_observed_(false) {
extensions_.Register<TransportSequenceNumber>(
@ -444,9 +445,9 @@ TEST_F(TransportFeedbackEndToEndTest, TransportSeqNumOnAudioAndVideo) {
int64_t packet_id = unwrapper_.Unwrap(transport_sequence_number);
EXPECT_TRUE(received_packet_ids_.insert(packet_id).second);
if (rtp_packet.Ssrc() == kVideoSendSsrcs[0])
if (rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[0])
video_observed_ = true;
if (rtp_packet.Ssrc() == kAudioSendSsrc)
if (rtp_packet.Ssrc() == test::VideoTestConstants::kAudioSendSsrc)
audio_observed_ = true;
if (audio_observed_ && video_observed_ &&
received_packet_ids_.size() >= kMinPacketsToWaitFor) {

Просмотреть файл

@ -25,6 +25,7 @@
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/task_queue_for_test.h"
#include "test/call_test.h"
#include "test/video_test_constants.h"
namespace webrtc {
namespace {
@ -43,7 +44,7 @@ const size_t kNumTemporalLayers[] = {1, 2, 3};
class PictureIdObserver : public test::RtpRtcpObserver {
public:
explicit PictureIdObserver(VideoCodecType codec_type)
: test::RtpRtcpObserver(test::CallTest::kDefaultTimeout),
: test::RtpRtcpObserver(test::VideoTestConstants::kDefaultTimeout),
depacketizer_(CreateVideoRtpDepacketizer(codec_type)),
max_expected_picture_id_gap_(0),
max_expected_tl0_idx_gap_(0),
@ -84,9 +85,10 @@ class PictureIdObserver : public test::RtpRtcpObserver {
ParsedPacket* parsed) const {
RtpPacket rtp_packet;
EXPECT_TRUE(rtp_packet.Parse(packet, length));
EXPECT_TRUE(rtp_packet.Ssrc() == test::CallTest::kVideoSendSsrcs[0] ||
rtp_packet.Ssrc() == test::CallTest::kVideoSendSsrcs[1] ||
rtp_packet.Ssrc() == test::CallTest::kVideoSendSsrcs[2])
EXPECT_TRUE(
rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[0] ||
rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[1] ||
rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[2])
<< "Unknown SSRC sent.";
if (rtp_packet.payload_size() == 0) {
@ -257,7 +259,8 @@ void PictureIdTest::SetupEncoder(VideoEncoderFactory* encoder_factory,
task_queue(), [this, encoder_factory, payload_name]() {
CreateCalls();
CreateSendTransport(BuiltInNetworkBehaviorConfig(), observer_.get());
CreateSendConfig(kNumSimulcastStreams, 0, 0, send_transport_.get());
CreateSendConfig(test::VideoTestConstants::kNumSimulcastStreams, 0, 0,
send_transport_.get());
GetVideoSendConfig()->encoder_settings.encoder_factory =
encoder_factory;
GetVideoSendConfig()->rtp.payload_name = payload_name;

Просмотреть файл

@ -19,6 +19,7 @@
#include "test/call_test.h"
#include "test/field_trial.h"
#include "test/frame_generator_capturer.h"
#include "test/video_test_constants.h"
#include "video/config/encoder_stream_factory.h"
namespace webrtc {
@ -126,7 +127,8 @@ class ScalingObserver : public test::SendTest {
VideoEncoder::EncoderInfo encoder_info;
send_config->encoder_settings.encoder_factory = &encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
const VideoCodecType codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->codec_type = codec_type;

Просмотреть файл

@ -34,6 +34,7 @@
#include "test/testsupport/file_utils.h"
#include "test/testsupport/frame_writer.h"
#include "test/testsupport/test_artifacts.h"
#include "test/video_test_constants.h"
ABSL_FLAG(bool,
save_worst_frame,
@ -59,7 +60,7 @@ constexpr int kKeepAliveIntervalIterations =
kKeepAliveInterval.ms() / kProbingInterval.ms();
bool IsFlexfec(int payload_type) {
return payload_type == test::CallTest::kFlexfecPayloadType;
return payload_type == test::VideoTestConstants::kFlexfecPayloadType;
}
} // namespace
@ -437,7 +438,7 @@ double VideoAnalyzer::GetCpuUsagePercent() {
bool VideoAnalyzer::IsInSelectedSpatialAndTemporalLayer(
const RtpPacket& rtp_packet) {
if (rtp_packet.PayloadType() == test::CallTest::kPayloadTypeVP8) {
if (rtp_packet.PayloadType() == test::VideoTestConstants::kPayloadTypeVP8) {
auto parsed_payload = vp8_depacketizer_->Parse(rtp_packet.PayloadBuffer());
RTC_DCHECK(parsed_payload);
const auto& vp8_header = absl::get<RTPVideoHeaderVP8>(
@ -447,7 +448,7 @@ bool VideoAnalyzer::IsInSelectedSpatialAndTemporalLayer(
temporal_idx <= selected_tl_;
}
if (rtp_packet.PayloadType() == test::CallTest::kPayloadTypeVP9) {
if (rtp_packet.PayloadType() == test::VideoTestConstants::kPayloadTypeVP9) {
auto parsed_payload = vp9_depacketizer_->Parse(rtp_packet.PayloadBuffer());
RTC_DCHECK(parsed_payload);
const auto& vp9_header = absl::get<RTPVideoHeaderVP9>(

Просмотреть файл

@ -54,6 +54,7 @@
#ifdef WEBRTC_WIN
#include "modules/audio_device/include/audio_device_factory.h"
#endif
#include "test/video_test_constants.h"
#include "video/config/encoder_stream_factory.h"
namespace webrtc {
@ -714,26 +715,26 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
RTC_CHECK_GT(num_video_substreams, 0);
for (size_t i = 0; i < num_video_substreams; ++i)
video_send_configs_[video_idx].rtp.ssrcs.push_back(
kVideoSendSsrcs[total_streams_used + i]);
test::VideoTestConstants::kVideoSendSsrcs[total_streams_used + i]);
int payload_type;
if (params_.video[video_idx].codec == "H264") {
payload_type = kPayloadTypeH264;
payload_type = test::VideoTestConstants::kPayloadTypeH264;
} else if (params_.video[video_idx].codec == "VP8") {
payload_type = kPayloadTypeVP8;
payload_type = test::VideoTestConstants::kPayloadTypeVP8;
} else if (params_.video[video_idx].codec == "VP9") {
payload_type = kPayloadTypeVP9;
payload_type = test::VideoTestConstants::kPayloadTypeVP9;
} else if (params_.video[video_idx].codec == "multiplex") {
payload_type = kPayloadTypeVP9;
payload_type = test::VideoTestConstants::kPayloadTypeVP9;
} else if (params_.video[video_idx].codec == "FakeCodec") {
payload_type = kFakeVideoSendPayloadType;
payload_type = test::VideoTestConstants::kFakeVideoSendPayloadType;
} else {
RTC_CHECK(generic_codec_name.empty() ||
generic_codec_name == params_.video[video_idx].codec)
<< "Supplying multiple generic codecs is unsupported.";
RTC_LOG(LS_INFO) << "Treating codec " << params_.video[video_idx].codec
<< " as generic.";
payload_type = kPayloadTypeGeneric;
payload_type = test::VideoTestConstants::kPayloadTypeGeneric;
generic_codec_name = params_.video[video_idx].codec;
}
video_send_configs_[video_idx].encoder_settings.encoder_factory =
@ -745,11 +746,13 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
video_send_configs_[video_idx].rtp.payload_name =
params_.video[video_idx].codec;
video_send_configs_[video_idx].rtp.payload_type = payload_type;
video_send_configs_[video_idx].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
video_send_configs_[video_idx].rtp.rtx.payload_type = kSendRtxPayloadType;
video_send_configs_[video_idx].rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
video_send_configs_[video_idx].rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
for (size_t i = 0; i < num_video_substreams; ++i) {
video_send_configs_[video_idx].rtp.rtx.ssrcs.push_back(
kSendRtxSsrcs[i + total_streams_used]);
test::VideoTestConstants::kSendRtxSsrcs[i + total_streams_used]);
}
video_send_configs_[video_idx].rtp.extensions.clear();
if (params_.call.send_side_bwe) {
@ -824,7 +827,7 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
decode_sub_stream = params_.ss[video_idx].selected_stream;
CreateMatchingVideoReceiveConfigs(
video_send_configs_[video_idx], recv_transport, &video_decoder_factory_,
decode_sub_stream, true, kNackRtpHistoryMs);
decode_sub_stream, true, test::VideoTestConstants::kNackRtpHistoryMs);
if (params_.screenshare[video_idx].enabled) {
// Fill out codec settings.
@ -925,7 +928,9 @@ void VideoQualityTest::SetupVideo(Transport* send_transport,
if (decode_all_receive_streams) {
SetSendFecConfig(GetVideoSendConfig()->rtp.ssrcs);
} else {
SetSendFecConfig({kVideoSendSsrcs[params_.ss[0].selected_stream]});
SetSendFecConfig(
{test::VideoTestConstants::kVideoSendSsrcs[params_.ss[0]
.selected_stream]});
}
CreateMatchingFecConfig(recv_transport, *GetVideoSendConfig());
@ -956,9 +961,12 @@ void VideoQualityTest::SetupThumbnails(Transport* send_transport,
thumbnail_send_config.encoder_settings.bitrate_allocator_factory =
video_bitrate_allocator_factory_.get();
thumbnail_send_config.rtp.payload_name = params_.video[0].codec;
thumbnail_send_config.rtp.payload_type = kPayloadTypeVP8;
thumbnail_send_config.rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
thumbnail_send_config.rtp.rtx.payload_type = kSendRtxPayloadType;
thumbnail_send_config.rtp.payload_type =
test::VideoTestConstants::kPayloadTypeVP8;
thumbnail_send_config.rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
thumbnail_send_config.rtp.rtx.payload_type =
test::VideoTestConstants::kSendRtxPayloadType;
thumbnail_send_config.rtp.rtx.ssrcs.push_back(kThumbnailRtxSsrcStart + i);
thumbnail_send_config.rtp.extensions.clear();
if (params_.call.send_side_bwe) {
@ -988,7 +996,8 @@ void VideoQualityTest::SetupThumbnails(Transport* send_transport,
AddMatchingVideoReceiveConfigs(
&thumbnail_receive_configs_, thumbnail_send_config, send_transport,
&video_decoder_factory_, absl::nullopt, false, kNackRtpHistoryMs);
&video_decoder_factory_, absl::nullopt, false,
test::VideoTestConstants::kNackRtpHistoryMs);
}
for (size_t i = 0; i < thumbnail_send_configs_.size(); ++i) {
thumbnail_send_streams_.push_back(receiver_call_->CreateVideoSendStream(
@ -1169,11 +1178,12 @@ VideoQualityTest::CreateSendTransport() {
return std::make_unique<test::LayerFilteringTransport>(
task_queue(),
std::make_unique<FakeNetworkPipe>(clock_, std::move(network_behavior)),
sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9,
params_.video[0].selected_tl, params_.ss[0].selected_sl,
payload_type_map_, kVideoSendSsrcs[0],
static_cast<uint32_t>(kVideoSendSsrcs[0] + params_.ss[0].streams.size() -
1),
sender_call_.get(), test::VideoTestConstants::kPayloadTypeVP8,
test::VideoTestConstants::kPayloadTypeVP9, params_.video[0].selected_tl,
params_.ss[0].selected_sl, payload_type_map_,
test::VideoTestConstants::kVideoSendSsrcs[0],
static_cast<uint32_t>(test::VideoTestConstants::kVideoSendSsrcs[0] +
params_.ss[0].streams.size() - 1),
GetRegisteredExtensions(), GetRegisteredExtensions());
}
@ -1263,8 +1273,8 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) {
? TimeDelta::Millis(1)
: TimeDelta::Seconds(params_.analyzer.test_durations_secs),
graph_data_output_file, graph_title,
kVideoSendSsrcs[params_.ss[0].selected_stream],
kSendRtxSsrcs[params_.ss[0].selected_stream],
test::VideoTestConstants::kVideoSendSsrcs[params_.ss[0].selected_stream],
test::VideoTestConstants::kSendRtxSsrcs[params_.ss[0].selected_stream],
static_cast<size_t>(params_.ss[0].selected_stream),
params.ss[0].selected_sl, params_.video[0].selected_tl,
is_quick_test_enabled, clock_, params_.logging.rtp_dump_name,
@ -1393,13 +1403,13 @@ void VideoQualityTest::InitializeAudioDevice(Call::Config* send_call_config,
void VideoQualityTest::SetupAudio(Transport* transport) {
AudioSendStream::Config audio_send_config(transport);
audio_send_config.rtp.ssrc = kAudioSendSsrc;
audio_send_config.rtp.ssrc = test::VideoTestConstants::kAudioSendSsrc;
// Add extension to enable audio send side BWE, and allow audio bit rate
// adaptation.
audio_send_config.rtp.extensions.clear();
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
kAudioSendPayloadType,
test::VideoTestConstants::kAudioSendPayloadType,
{"OPUS",
48000,
2,

Просмотреть файл

@ -71,6 +71,7 @@
#include "test/rtcp_packet_parser.h"
#include "test/rtp_rtcp_observer.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/transport_adapter.h"
@ -186,7 +187,7 @@ TEST_F(VideoSendStreamTest, SupportsCName) {
static std::string kCName = "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo=";
class CNameObserver : public test::SendTest {
public:
CNameObserver() : SendTest(kDefaultTimeout) {}
CNameObserver() : SendTest(test::VideoTestConstants::kDefaultTimeout) {}
private:
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
@ -220,7 +221,8 @@ TEST_F(VideoSendStreamTest, SupportsCName) {
TEST_F(VideoSendStreamTest, SupportsAbsoluteSendTime) {
class AbsoluteSendTimeObserver : public test::SendTest {
public:
AbsoluteSendTimeObserver() : SendTest(kDefaultTimeout) {
AbsoluteSendTimeObserver()
: SendTest(test::VideoTestConstants::kDefaultTimeout) {
extensions_.Register<AbsoluteSendTime>(kAbsSendTimeExtensionId);
}
@ -271,7 +273,8 @@ TEST_F(VideoSendStreamTest, SupportsTransmissionTimeOffset) {
class TransmissionTimeOffsetObserver : public test::SendTest {
public:
TransmissionTimeOffsetObserver()
: SendTest(kDefaultTimeout), encoder_factory_([]() {
: SendTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_([]() {
return std::make_unique<test::DelayedEncoder>(
Clock::GetRealTimeClock(), kEncodeDelayMs);
}) {
@ -318,7 +321,8 @@ TEST_F(VideoSendStreamTest, SupportsTransportWideSequenceNumbers) {
class TransportWideSequenceNumberObserver : public test::SendTest {
public:
TransportWideSequenceNumberObserver()
: SendTest(kDefaultTimeout), encoder_factory_([]() {
: SendTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_([]() {
return std::make_unique<test::FakeEncoder>(
Clock::GetRealTimeClock());
}) {
@ -360,7 +364,8 @@ TEST_F(VideoSendStreamTest, SupportsTransportWideSequenceNumbers) {
TEST_F(VideoSendStreamTest, SupportsVideoRotation) {
class VideoRotationObserver : public test::SendTest {
public:
VideoRotationObserver() : SendTest(kDefaultTimeout) {
VideoRotationObserver()
: SendTest(test::VideoTestConstants::kDefaultTimeout) {
extensions_.Register<VideoOrientation>(kVideoRotationExtensionId);
}
@ -404,7 +409,8 @@ TEST_F(VideoSendStreamTest, SupportsVideoContentType) {
class VideoContentTypeObserver : public test::SendTest {
public:
VideoContentTypeObserver()
: SendTest(kDefaultTimeout), first_frame_sent_(false) {
: SendTest(test::VideoTestConstants::kDefaultTimeout),
first_frame_sent_(false) {
extensions_.Register<VideoContentTypeExtension>(
kVideoContentTypeExtensionId);
}
@ -450,7 +456,8 @@ TEST_F(VideoSendStreamTest, SupportsVideoTimingFrames) {
class VideoTimingObserver : public test::SendTest {
public:
VideoTimingObserver()
: SendTest(kDefaultTimeout), first_frame_sent_(false) {
: SendTest(test::VideoTestConstants::kDefaultTimeout),
first_frame_sent_(false) {
extensions_.Register<VideoTimingExtension>(kVideoTimingExtensionId);
}
@ -522,7 +529,7 @@ class UlpfecObserver : public test::EndToEndTest {
bool expect_ulpfec,
const std::string& codec,
VideoEncoderFactory* encoder_factory)
: EndToEndTest(expect_ulpfec ? VideoSendStreamTest::kDefaultTimeout
: EndToEndTest(expect_ulpfec ? test::VideoTestConstants::kDefaultTimeout
: kReducedTimeout),
encoder_factory_(encoder_factory),
payload_name_(codec),
@ -543,16 +550,16 @@ class UlpfecObserver : public test::EndToEndTest {
EXPECT_TRUE(rtp_packet.Parse(packet, length));
int encapsulated_payload_type = -1;
if (rtp_packet.PayloadType() == VideoSendStreamTest::kRedPayloadType) {
if (rtp_packet.PayloadType() == test::VideoTestConstants::kRedPayloadType) {
EXPECT_TRUE(expect_red_);
encapsulated_payload_type = rtp_packet.payload()[0];
if (encapsulated_payload_type !=
VideoSendStreamTest::kFakeVideoSendPayloadType) {
EXPECT_EQ(VideoSendStreamTest::kUlpfecPayloadType,
test::VideoTestConstants::kFakeVideoSendPayloadType) {
EXPECT_EQ(test::VideoTestConstants::kUlpfecPayloadType,
encapsulated_payload_type);
}
} else {
EXPECT_EQ(VideoSendStreamTest::kFakeVideoSendPayloadType,
EXPECT_EQ(test::VideoTestConstants::kFakeVideoSendPayloadType,
rtp_packet.PayloadType());
if (rtp_packet.payload_size() > 0) {
// Not padding-only, media received outside of RED.
@ -587,7 +594,7 @@ class UlpfecObserver : public test::EndToEndTest {
if (encapsulated_payload_type != -1) {
if (encapsulated_payload_type ==
VideoSendStreamTest::kUlpfecPayloadType) {
test::VideoTestConstants::kUlpfecPayloadType) {
EXPECT_TRUE(expect_ulpfec_);
sent_ulpfec_ = true;
} else {
@ -619,14 +626,14 @@ class UlpfecObserver : public test::EndToEndTest {
if (use_nack_) {
send_config->rtp.nack.rtp_history_ms =
(*receive_configs)[0].rtp.nack.rtp_history_ms =
VideoSendStreamTest::kNackRtpHistoryMs;
test::VideoTestConstants::kNackRtpHistoryMs;
}
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.ulpfec.red_payload_type =
VideoSendStreamTest::kRedPayloadType;
test::VideoTestConstants::kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
VideoSendStreamTest::kUlpfecPayloadType;
test::VideoTestConstants::kUlpfecPayloadType;
if (!header_extensions_enabled_) {
send_config->rtp.extensions.clear();
} else {
@ -746,7 +753,7 @@ class FlexfecObserver : public test::EndToEndTest {
const std::string& codec,
VideoEncoderFactory* encoder_factory,
size_t num_video_streams)
: EndToEndTest(VideoSendStreamTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_(encoder_factory),
payload_name_(codec),
use_nack_(use_nack),
@ -768,15 +775,17 @@ class FlexfecObserver : public test::EndToEndTest {
RtpPacket rtp_packet(&extensions_);
EXPECT_TRUE(rtp_packet.Parse(packet, length));
if (rtp_packet.PayloadType() == VideoSendStreamTest::kFlexfecPayloadType) {
EXPECT_EQ(VideoSendStreamTest::kFlexfecSendSsrc, rtp_packet.Ssrc());
if (rtp_packet.PayloadType() ==
test::VideoTestConstants::kFlexfecPayloadType) {
EXPECT_EQ(test::VideoTestConstants::kFlexfecSendSsrc, rtp_packet.Ssrc());
sent_flexfec_ = true;
} else {
EXPECT_EQ(VideoSendStreamTest::kFakeVideoSendPayloadType,
EXPECT_EQ(test::VideoTestConstants::kFakeVideoSendPayloadType,
rtp_packet.PayloadType());
EXPECT_THAT(::testing::make_tuple(VideoSendStreamTest::kVideoSendSsrcs,
num_video_streams_),
::testing::Contains(rtp_packet.Ssrc()));
EXPECT_THAT(
::testing::make_tuple(test::VideoTestConstants::kVideoSendSsrcs,
num_video_streams_),
::testing::Contains(rtp_packet.Ssrc()));
sent_media_ = true;
}
@ -819,7 +828,7 @@ class FlexfecObserver : public test::EndToEndTest {
if (use_nack_) {
send_config->rtp.nack.rtp_history_ms =
(*receive_configs)[0].rtp.nack.rtp_history_ms =
VideoSendStreamTest::kNackRtpHistoryMs;
test::VideoTestConstants::kNackRtpHistoryMs;
}
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
@ -928,7 +937,7 @@ void VideoSendStreamTest::TestNackRetransmission(
public:
explicit NackObserver(uint32_t retransmit_ssrc,
uint8_t retransmit_payload_type)
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
send_count_(0),
retransmit_count_(0),
retransmit_ssrc_(retransmit_ssrc),
@ -956,11 +965,12 @@ void VideoSendStreamTest::TestNackRetransmission(
config.clock = Clock::GetRealTimeClock();
config.outgoing_transport = transport_adapter_.get();
config.rtcp_report_interval = TimeDelta::Millis(kRtcpIntervalMs);
config.local_media_ssrc = kReceiverLocalVideoSsrc;
config.local_media_ssrc =
test::VideoTestConstants::kReceiverLocalVideoSsrc;
RTCPSender rtcp_sender(config);
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender.SetRemoteSSRC(kVideoSendSsrcs[0]);
rtcp_sender.SetRemoteSSRC(test::VideoTestConstants::kVideoSendSsrcs[0]);
RTCPSender::FeedbackState feedback_state;
uint16_t nack_sequence_numbers[kNackedPacketsAtOnceCount];
@ -980,7 +990,7 @@ void VideoSendStreamTest::TestNackRetransmission(
uint16_t sequence_number = rtp_packet.SequenceNumber();
if (rtp_packet.Ssrc() == retransmit_ssrc_ &&
retransmit_ssrc_ != kVideoSendSsrcs[0]) {
retransmit_ssrc_ != test::VideoTestConstants::kVideoSendSsrcs[0]) {
// Not kVideoSendSsrcs[0], assume correct RTX packet. Extract sequence
// number.
const uint8_t* rtx_header = rtp_packet.payload().data();
@ -991,7 +1001,7 @@ void VideoSendStreamTest::TestNackRetransmission(
if (it == sequence_numbers_pending_retransmission_.end()) {
// Not currently pending retransmission. Add it to retransmission queue
// if media and limit not reached.
if (rtp_packet.Ssrc() == kVideoSendSsrcs[0] &&
if (rtp_packet.Ssrc() == test::VideoTestConstants::kVideoSendSsrcs[0] &&
rtp_packet.payload_size() > 0 &&
retransmit_count_ +
sequence_numbers_pending_retransmission_.size() <
@ -1019,9 +1029,10 @@ void VideoSendStreamTest::TestNackRetransmission(
transport_adapter_.reset(
new internal::TransportAdapter(send_config->send_transport));
transport_adapter_->Enable();
send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
send_config->rtp.nack.rtp_history_ms =
test::VideoTestConstants::kNackRtpHistoryMs;
send_config->rtp.rtx.payload_type = retransmit_payload_type_;
if (retransmit_ssrc_ != kVideoSendSsrcs[0])
if (retransmit_ssrc_ != test::VideoTestConstants::kVideoSendSsrcs[0])
send_config->rtp.rtx.ssrcs.push_back(retransmit_ssrc_);
}
@ -1042,12 +1053,14 @@ void VideoSendStreamTest::TestNackRetransmission(
TEST_F(VideoSendStreamTest, RetransmitsNack) {
// Normal NACKs should use the send SSRC.
TestNackRetransmission(kVideoSendSsrcs[0], kFakeVideoSendPayloadType);
TestNackRetransmission(test::VideoTestConstants::kVideoSendSsrcs[0],
test::VideoTestConstants::kFakeVideoSendPayloadType);
}
TEST_F(VideoSendStreamTest, RetransmitsNackOverRtx) {
// NACKs over RTX should use a separate SSRC.
TestNackRetransmission(kSendRtxSsrcs[0], kSendRtxPayloadType);
TestNackRetransmission(test::VideoTestConstants::kSendRtxSsrcs[0],
test::VideoTestConstants::kSendRtxPayloadType);
}
void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
@ -1068,7 +1081,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
size_t stop_size,
bool test_generic_packetization,
bool use_fec)
: SendTest(kLongTimeout),
: SendTest(test::VideoTestConstants::kLongTimeout),
encoder_(stop),
encoder_factory_(&encoder_),
max_packet_size_(max_packet_size),
@ -1101,8 +1114,10 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
if (use_fec_ && rtp_packet.payload_size() > 0) {
uint8_t payload_type = rtp_packet.payload()[0];
bool is_fec = rtp_packet.PayloadType() == kRedPayloadType &&
payload_type == kUlpfecPayloadType;
bool is_fec =
rtp_packet.PayloadType() ==
test::VideoTestConstants::kRedPayloadType &&
payload_type == test::VideoTestConstants::kUlpfecPayloadType;
if (is_fec) {
fec_packet_received_ = true;
return SEND_PACKET;
@ -1181,7 +1196,8 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
uint8_t loss_ratio =
static_cast<uint8_t>(loss_delta * 255 / packets_delta);
FakeReceiveStatistics lossy_receive_stats(
kVideoSendSsrcs[0], rtp_packet.SequenceNumber(),
test::VideoTestConstants::kVideoSendSsrcs[0],
rtp_packet.SequenceNumber(),
packets_lost_, // Cumulative lost.
loss_ratio); // Loss percent.
RTCPSender::Configuration config;
@ -1189,11 +1205,11 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
config.receive_statistics = &lossy_receive_stats;
config.outgoing_transport = transport_adapter_.get();
config.rtcp_report_interval = TimeDelta::Millis(kRtcpIntervalMs);
config.local_media_ssrc = kVideoSendSsrcs[0];
config.local_media_ssrc = test::VideoTestConstants::kVideoSendSsrcs[0];
RTCPSender rtcp_sender(config);
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender.SetRemoteSSRC(kVideoSendSsrcs[0]);
rtcp_sender.SetRemoteSSRC(test::VideoTestConstants::kVideoSendSsrcs[0]);
RTCPSender::FeedbackState feedback_state;
@ -1224,8 +1240,10 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
new internal::TransportAdapter(send_config->send_transport));
transport_adapter_->Enable();
if (use_fec_) {
send_config->rtp.ulpfec.red_payload_type = kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
send_config->rtp.ulpfec.red_payload_type =
test::VideoTestConstants::kRedPayloadType;
send_config->rtp.ulpfec.ulpfec_payload_type =
test::VideoTestConstants::kUlpfecPayloadType;
}
if (!test_generic_packetization_)
@ -1302,7 +1320,7 @@ TEST_F(VideoSendStreamTest, NoPaddingWhenVideoIsMuted) {
class NoPaddingWhenVideoIsMuted : public test::SendTest {
public:
NoPaddingWhenVideoIsMuted()
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
clock_(Clock::GetRealTimeClock()),
capturer_(nullptr) {}
@ -1391,7 +1409,7 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) {
class PaddingIsPrimarilyRetransmissions : public test::EndToEndTest {
public:
PaddingIsPrimarilyRetransmissions()
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
clock_(Clock::GetRealTimeClock()),
padding_length_(0),
total_length_(0),
@ -1426,8 +1444,10 @@ TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) {
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
VideoEncoderConfig* encoder_config) override {
// Turn on RTX.
send_config->rtp.rtx.payload_type = kFakeVideoSendPayloadType;
send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]);
send_config->rtp.rtx.payload_type =
test::VideoTestConstants::kFakeVideoSendPayloadType;
send_config->rtp.rtx.ssrcs.push_back(
test::VideoTestConstants::kSendRtxSsrcs[0]);
}
void PerformTest() override {
@ -1467,7 +1487,7 @@ TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
class BitrateObserver : public test::SendTest {
public:
explicit BitrateObserver(TaskQueueBase* task_queue)
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue),
retranmission_rate_limiter_(Clock::GetRealTimeClock(), 1000),
stream_(nullptr),
@ -1560,7 +1580,7 @@ TEST_F(VideoSendStreamTest, ChangingNetworkRoute) {
class ChangingNetworkRouteTest : public test::EndToEndTest {
public:
explicit ChangingNetworkRouteTest(TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue),
call_(nullptr) {
module_process_thread_.Detach();
@ -1680,7 +1700,7 @@ TEST_F(VideoSendStreamTest, DISABLED_RelayToDirectRoute) {
class RelayToDirectRouteTest : public test::EndToEndTest {
public:
explicit RelayToDirectRouteTest(TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue),
call_(nullptr),
packets_sent_(0),
@ -1775,7 +1795,7 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
class ChangingTransportOverheadTest : public test::EndToEndTest {
public:
explicit ChangingTransportOverheadTest(TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue),
call_(nullptr),
packets_sent_(0),
@ -1851,7 +1871,7 @@ class MaxPaddingSetTest : public test::SendTest {
MaxPaddingSetTest(bool test_switch_content_type,
T* stream_reset_fun,
TaskQueueBase* task_queue)
: SendTest(test::CallTest::kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
running_without_padding_(test_switch_content_type),
stream_resetter_(stream_reset_fun),
task_queue_(task_queue) {
@ -2009,7 +2029,7 @@ TEST_F(VideoSendStreamTest,
}
}
EXPECT_TRUE(
init_encode_called_.Wait(VideoSendStreamTest::kDefaultTimeout));
init_encode_called_.Wait(test::VideoTestConstants::kDefaultTimeout));
{
MutexLock lock(&mutex_);
EXPECT_EQ(width, last_initialized_frame_width_);
@ -2049,19 +2069,23 @@ TEST_F(VideoSendStreamTest,
CreateSendConfig(1, 0, 0, &transport);
GetVideoSendConfig()->encoder_settings.encoder_factory = &encoder_factory;
CreateVideoStreams();
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
frame_generator_capturer_->Start();
});
encoder.WaitForResolution(kDefaultWidth, kDefaultHeight);
encoder.WaitForResolution(test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
SendTask(task_queue(), [this]() {
frame_generator_capturer_->ChangeResolution(kDefaultWidth * 2,
kDefaultHeight * 2);
frame_generator_capturer_->ChangeResolution(
test::VideoTestConstants::kDefaultWidth * 2,
test::VideoTestConstants::kDefaultHeight * 2);
});
encoder.WaitForResolution(kDefaultWidth * 2, kDefaultHeight * 2);
encoder.WaitForResolution(test::VideoTestConstants::kDefaultWidth * 2,
test::VideoTestConstants::kDefaultHeight * 2);
SendTask(task_queue(), [this]() {
DestroyStreams();
@ -2095,7 +2119,8 @@ TEST_F(VideoSendStreamTest, CanReconfigureToUseStartBitrateAbovePreviousMax) {
}
bool WaitForStartBitrate() {
return start_bitrate_changed_.Wait(VideoSendStreamTest::kDefaultTimeout);
return start_bitrate_changed_.Wait(
test::VideoTestConstants::kDefaultTimeout);
}
private:
@ -2122,8 +2147,9 @@ TEST_F(VideoSendStreamTest, CanReconfigureToUseStartBitrateAbovePreviousMax) {
CreateVideoStreams();
// Start capturing and encoding frames to force encoder reconfiguration.
CreateFrameGeneratorCapturer(kDefaultFramerate, kDefaultWidth,
kDefaultHeight);
CreateFrameGeneratorCapturer(test::VideoTestConstants::kDefaultFramerate,
test::VideoTestConstants::kDefaultWidth,
test::VideoTestConstants::kDefaultHeight);
frame_generator_capturer_->Start();
// TODO(crbug/1255737): Added manual current thread message processing because
// the test code context is interpreted as the worker thread and we assume
@ -2173,7 +2199,7 @@ class StartStopBitrateObserver : public test::FakeEncoder {
}
bool WaitForEncoderInit() {
return encoder_init_.Wait(VideoSendStreamTest::kDefaultTimeout);
return encoder_init_.Wait(test::VideoTestConstants::kDefaultTimeout);
}
bool WaitBitrateChanged(WaitUntil until) {
@ -2190,7 +2216,7 @@ class StartStopBitrateObserver : public test::FakeEncoder {
(until == WaitUntil::kZero && *bitrate_kbps == 0)) {
return true;
}
} while (bitrate_changed_.Wait(VideoSendStreamTest::kDefaultTimeout));
} while (bitrate_changed_.Wait(test::VideoTestConstants::kDefaultTimeout));
return false;
}
@ -2205,7 +2231,7 @@ TEST_F(VideoSendStreamTest, EncoderIsProperlyInitializedAndDestroyed) {
class EncoderStateObserver : public test::SendTest, public VideoEncoder {
public:
explicit EncoderStateObserver(TaskQueueBase* task_queue)
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
task_queue_(task_queue),
stream_(nullptr),
initialized_(false),
@ -2338,7 +2364,7 @@ class VideoCodecConfigObserver : public test::SendTest,
public:
VideoCodecConfigObserver(VideoCodecType video_codec_type,
TaskQueueBase* task_queue)
: SendTest(VideoSendStreamTest::kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
video_codec_type_(video_codec_type),
stream_(nullptr),
@ -2384,7 +2410,8 @@ class VideoCodecConfigObserver : public test::SendTest,
GetEncoderSpecificSettings() const;
void PerformTest() override {
EXPECT_TRUE(init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeout));
EXPECT_TRUE(
init_encode_event_.Wait(test::VideoTestConstants::kDefaultTimeout));
ASSERT_EQ(1, FakeEncoder::GetNumInitializations())
<< "VideoEncoder not initialized.";
@ -2394,7 +2421,8 @@ class VideoCodecConfigObserver : public test::SendTest,
SendTask(task_queue_, [&]() {
stream_->ReconfigureVideoEncoder(std::move(encoder_config_));
});
ASSERT_TRUE(init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeout));
ASSERT_TRUE(
init_encode_event_.Wait(test::VideoTestConstants::kDefaultTimeout));
EXPECT_EQ(2, FakeEncoder::GetNumInitializations())
<< "ReconfigureVideoEncoder did not reinitialize the encoder with "
"new encoder settings.";
@ -2539,7 +2567,7 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) {
class RtcpSenderReportTest : public test::SendTest {
public:
RtcpSenderReportTest()
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
rtp_packets_sent_(0),
media_bytes_sent_(0) {}
@ -2614,7 +2642,7 @@ TEST_F(VideoSendStreamTest, TranslatesTwoLayerScreencastToTargetBitrate) {
public test::FakeEncoder {
public:
ScreencastTargetBitrateTest()
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
test::FakeEncoder(Clock::GetRealTimeClock()),
encoder_factory_(this) {}
@ -2672,7 +2700,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
public test::FakeEncoder {
public:
explicit EncoderBitrateThresholdObserver(TaskQueueBase* task_queue)
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
task_queue_(task_queue),
target_bitrate_(0),
@ -2760,7 +2788,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
}
} while (bitrate_changed_event_.Wait(
std::max(TimeDelta::Millis(1),
VideoSendStreamTest::kDefaultTimeout -
test::VideoTestConstants::kDefaultTimeout -
TimeDelta::Millis(rtc::TimeMillis() - start_time))));
MutexLock lock(&mutex_);
EXPECT_NEAR(target_bitrate_, expected_bitrate, abs_error)
@ -2801,9 +2829,10 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
void PerformTest() override {
ASSERT_TRUE(create_rate_allocator_event_.Wait(
VideoSendStreamTest::kDefaultTimeout))
test::VideoTestConstants::kDefaultTimeout))
<< "Timed out while waiting for rate allocator to be created.";
ASSERT_TRUE(init_encode_event_.Wait(VideoSendStreamTest::kDefaultTimeout))
ASSERT_TRUE(
init_encode_event_.Wait(test::VideoTestConstants::kDefaultTimeout))
<< "Timed out while waiting for encoder to be configured.";
WaitForSetRates(kStartBitrateKbps, 80);
BitrateConstraints bitrate_config;
@ -2820,7 +2849,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
});
ASSERT_TRUE(create_rate_allocator_event_.Wait(
VideoSendStreamTest::kDefaultTimeout));
test::VideoTestConstants::kDefaultTimeout));
EXPECT_EQ(2, num_rate_allocator_creations_)
<< "Rate allocator should have been recreated.";
@ -2832,7 +2861,7 @@ TEST_F(VideoSendStreamTest, ReconfigureBitratesSetsEncoderBitratesCorrectly) {
send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
});
ASSERT_TRUE(create_rate_allocator_event_.Wait(
VideoSendStreamTest::kDefaultTimeout));
test::VideoTestConstants::kDefaultTimeout));
EXPECT_EQ(3, num_rate_allocator_creations_)
<< "Rate allocator should have been recreated.";
@ -2872,7 +2901,7 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
public test::FakeEncoder {
public:
explicit ScreencastTargetBitrateTest(TaskQueueBase* task_queue)
: SendTest(kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
test::FakeEncoder(Clock::GetRealTimeClock()),
send_stream_(nullptr),
encoder_factory_(this),
@ -2928,12 +2957,14 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
SendTask(task_queue_, [&]() { stats = send_stream_->GetStats(); });
for (size_t i = 0; i < kNumStreams; ++i) {
ASSERT_TRUE(stats.substreams.find(kVideoSendSsrcs[i]) !=
ASSERT_TRUE(stats.substreams.find(
test::VideoTestConstants::kVideoSendSsrcs[i]) !=
stats.substreams.end())
<< "No stats for SSRC: " << kVideoSendSsrcs[i]
<< "No stats for SSRC: "
<< test::VideoTestConstants::kVideoSendSsrcs[i]
<< ", stats should exist as soon as frames have been encoded.";
VideoSendStream::StreamStats ssrc_stats =
stats.substreams[kVideoSendSsrcs[i]];
stats.substreams[test::VideoTestConstants::kVideoSendSsrcs[i]];
EXPECT_EQ(kEncodedResolution[i].width, ssrc_stats.width);
EXPECT_EQ(kEncodedResolution[i].height, ssrc_stats.height);
}
@ -2957,7 +2988,7 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
class Vp9HeaderObserver : public test::SendTest {
public:
explicit Vp9HeaderObserver(const Vp9TestParams& params)
: SendTest(VideoSendStreamTest::kLongTimeout),
: SendTest(test::VideoTestConstants::kLongTimeout),
encoder_factory_([]() { return VP9Encoder::Create(); }),
params_(params),
vp9_settings_(VideoEncoder::GetDefaultVp9Settings()) {}
@ -2970,7 +3001,7 @@ class Vp9HeaderObserver : public test::SendTest {
virtual void InspectHeader(const RTPVideoHeaderVP9& vp9) = 0;
private:
const int kVp9PayloadType = test::CallTest::kVideoSendPayloadType;
const int kVp9PayloadType = test::VideoTestConstants::kVideoSendPayloadType;
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
@ -3642,7 +3673,7 @@ TEST_F(VideoSendStreamTest, EncoderConfigMaxFramerateReportedToSource) {
class FpsObserver : public test::SendTest,
public test::FrameGeneratorCapturer::SinkWantsObserver {
public:
FpsObserver() : SendTest(kDefaultTimeout) {}
FpsObserver() : SendTest(test::VideoTestConstants::kDefaultTimeout) {}
void OnFrameGeneratorCapturerCreated(
test::FrameGeneratorCapturer* frame_generator_capturer) override {
@ -3678,7 +3709,7 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
public test::FakeEncoder {
public:
explicit RemoveOverheadFromBandwidthTest(TaskQueueBase* task_queue)
: EndToEndTest(test::CallTest::kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
FakeEncoder(Clock::GetRealTimeClock()),
task_queue_(task_queue),
encoder_factory_(this),
@ -3733,8 +3764,8 @@ TEST_F(VideoSendStreamTest, RemoveOverheadFromBandwidth) {
// At a bitrate of 60kbps with a packet size of 1200B video and an
// overhead of 40B per packet video produces 2240bps overhead.
// So the encoder BW should be set to 57760bps.
EXPECT_TRUE(
bitrate_changed_event_.Wait(VideoSendStreamTest::kDefaultTimeout));
EXPECT_TRUE(bitrate_changed_event_.Wait(
test::VideoTestConstants::kDefaultTimeout));
{
MutexLock lock(&mutex_);
EXPECT_LE(max_bitrate_bps_, 57760u);
@ -3757,7 +3788,7 @@ class PacingFactorObserver : public test::SendTest {
public:
PacingFactorObserver(bool configure_send_side,
absl::optional<float> expected_pacing_factor)
: test::SendTest(VideoSendStreamTest::kDefaultTimeout),
: test::SendTest(test::VideoTestConstants::kDefaultTimeout),
configure_send_side_(configure_send_side),
expected_pacing_factor_(expected_pacing_factor) {}
@ -3854,7 +3885,7 @@ class ContentSwitchTest : public test::SendTest {
static const uint32_t kMinPacketsToSend = 50;
explicit ContentSwitchTest(T* stream_reset_fun, TaskQueueBase* task_queue)
: SendTest(test::CallTest::kDefaultTimeout),
: SendTest(test::VideoTestConstants::kDefaultTimeout),
call_(nullptr),
state_(StreamState::kBeforeSwitch),
send_stream_(nullptr),
@ -3950,7 +3981,8 @@ class ContentSwitchTest : public test::SendTest {
void PerformTest() override {
while (GetStreamState() != StreamState::kAfterSwitchBack) {
ASSERT_TRUE(content_switch_event_.Wait(test::CallTest::kDefaultTimeout));
ASSERT_TRUE(content_switch_event_.Wait(
test::VideoTestConstants::kDefaultTimeout));
(*stream_resetter_)(send_stream_config_, encoder_config_, this);
}
@ -4014,7 +4046,7 @@ void VideoSendStreamTest::TestTemporalLayers(
const std::string& payload_name,
const std::vector<int>& num_temporal_layers,
const std::vector<ScalabilityMode>& scalability_mode)
: EndToEndTest(kDefaultTimeout),
: EndToEndTest(test::VideoTestConstants::kDefaultTimeout),
encoder_factory_(encoder_factory),
payload_name_(payload_name),
num_temporal_layers_(num_temporal_layers),
@ -4051,7 +4083,8 @@ void VideoSendStreamTest::TestTemporalLayers(
webrtc::VideoEncoder::EncoderInfo encoder_info;
send_config->encoder_settings.encoder_factory = encoder_factory_;
send_config->rtp.payload_name = payload_name_;
send_config->rtp.payload_type = test::CallTest::kVideoSendPayloadType;
send_config->rtp.payload_type =
test::VideoTestConstants::kVideoSendPayloadType;
encoder_config->video_format.name = payload_name_;
encoder_config->codec_type = PayloadStringToCodecType(payload_name_);
encoder_config->video_stream_factory =