2014-06-27 08:47:52 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 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.
|
|
|
|
|
*/
|
2016-11-15 07:10:52 -08:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/call_test.h"
|
2016-11-15 07:10:52 -08:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
2019-09-17 17:06:18 +02:00
|
|
|
#include <memory>
|
2016-11-15 07:10:52 -08:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
|
|
|
|
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
2019-04-18 10:58:56 +02:00
|
|
|
#include "api/task_queue/default_task_queue_factory.h"
|
2019-09-30 04:16:28 +02:00
|
|
|
#include "api/task_queue/task_queue_base.h"
|
2018-11-08 10:02:56 -08:00
|
|
|
#include "api/video/builtin_video_bitrate_allocator_factory.h"
|
2018-05-18 11:37:23 +02:00
|
|
|
#include "api/video_codecs/video_encoder_config.h"
|
2018-08-20 13:30:39 +02:00
|
|
|
#include "call/fake_network_pipe.h"
|
|
|
|
|
#include "call/simulated_network.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_mixer/audio_mixer_impl.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
#include "rtc_base/event.h"
|
2019-10-21 09:24:27 +02:00
|
|
|
#include "rtc_base/task_queue_for_test.h"
|
2018-04-19 09:04:13 +02:00
|
|
|
#include "test/fake_encoder.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "test/testsupport/file_utils.h"
|
2017-08-22 04:02:52 -07:00
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
CallTest::CallTest()
|
2014-07-07 13:06:48 +00:00
|
|
|
: clock_(Clock::GetRealTimeClock()),
|
2019-04-18 10:58:56 +02:00
|
|
|
task_queue_factory_(CreateDefaultTaskQueueFactory()),
|
2019-09-17 17:06:18 +02:00
|
|
|
send_event_log_(std::make_unique<RtcEventLogNull>()),
|
|
|
|
|
recv_event_log_(std::make_unique<RtcEventLogNull>()),
|
2019-11-26 09:19:40 -08:00
|
|
|
audio_send_config_(/*send_transport=*/nullptr),
|
2016-01-07 17:43:18 +01:00
|
|
|
audio_send_stream_(nullptr),
|
2019-01-09 15:46:36 +01:00
|
|
|
frame_generator_capturer_(nullptr),
|
2018-04-19 09:04:13 +02:00
|
|
|
fake_encoder_factory_([this]() {
|
2018-08-27 14:12:27 +02:00
|
|
|
std::unique_ptr<FakeEncoder> fake_encoder;
|
|
|
|
|
if (video_encoder_configs_[0].codec_type == kVideoCodecVP8) {
|
2019-09-17 17:06:18 +02:00
|
|
|
fake_encoder = std::make_unique<FakeVP8Encoder>(clock_);
|
2018-08-27 14:12:27 +02:00
|
|
|
} else {
|
2019-09-17 17:06:18 +02:00
|
|
|
fake_encoder = std::make_unique<FakeEncoder>(clock_);
|
2018-08-27 14:12:27 +02:00
|
|
|
}
|
|
|
|
|
fake_encoder->SetMaxBitrate(fake_encoder_max_bitrate_);
|
|
|
|
|
return fake_encoder;
|
2018-04-19 09:04:13 +02:00
|
|
|
}),
|
2019-09-17 17:06:18 +02:00
|
|
|
fake_decoder_factory_([]() { return std::make_unique<FakeDecoder>(); }),
|
2018-11-08 10:02:56 -08:00
|
|
|
bitrate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()),
|
2016-01-14 20:34:30 +01:00
|
|
|
num_video_streams_(1),
|
2016-01-07 17:43:18 +01:00
|
|
|
num_audio_streams_(0),
|
2016-11-15 07:10:52 -08:00
|
|
|
num_flexfec_streams_(0),
|
2018-03-28 14:16:04 +02:00
|
|
|
audio_decoder_factory_(CreateBuiltinAudioDecoderFactory()),
|
|
|
|
|
audio_encoder_factory_(CreateBuiltinAudioEncoderFactory()),
|
2019-11-13 11:19:53 +01:00
|
|
|
task_queue_(task_queue_factory_->CreateTaskQueue(
|
|
|
|
|
"CallTestTaskQueue",
|
|
|
|
|
TaskQueueFactory::Priority::NORMAL)) {}
|
2014-10-22 12:15:24 +00:00
|
|
|
|
2019-10-31 12:33:17 +01:00
|
|
|
CallTest::~CallTest() = default;
|
2014-06-27 08:47:52 +00:00
|
|
|
|
Reland "Delete test/constants.h"
This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.
Reason for revert: Failing tests fixed.
Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}
TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
|
|
|
void CallTest::RegisterRtpExtension(const RtpExtension& extension) {
|
|
|
|
|
for (const RtpExtension& registered_extension : rtp_extensions_) {
|
|
|
|
|
if (registered_extension.id == extension.id) {
|
|
|
|
|
ASSERT_EQ(registered_extension.uri, extension.uri)
|
|
|
|
|
<< "Different URIs associated with ID " << extension.id << ".";
|
|
|
|
|
ASSERT_EQ(registered_extension.encrypt, extension.encrypt)
|
|
|
|
|
<< "Encryption mismatch associated with ID " << extension.id << ".";
|
|
|
|
|
return;
|
|
|
|
|
} else { // Different IDs.
|
|
|
|
|
// Different IDs referring to the same extension probably indicate
|
|
|
|
|
// a mistake in the test.
|
|
|
|
|
ASSERT_FALSE(registered_extension.uri == extension.uri &&
|
|
|
|
|
registered_extension.encrypt == extension.encrypt)
|
|
|
|
|
<< "URI " << extension.uri
|
|
|
|
|
<< (extension.encrypt ? " with " : " without ")
|
|
|
|
|
<< "encryption already registered with a different "
|
|
|
|
|
<< "ID (" << extension.id << " vs. " << registered_extension.id
|
|
|
|
|
<< ").";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rtp_extensions_.push_back(extension);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-08 06:47:13 -08:00
|
|
|
void CallTest::RunBaseTest(BaseTest* test) {
|
2019-11-13 11:19:53 +01:00
|
|
|
SendTask(RTC_FROM_HERE, task_queue(), [this, test]() {
|
2017-08-22 04:02:52 -07:00
|
|
|
num_video_streams_ = test->GetNumVideoStreams();
|
|
|
|
|
num_audio_streams_ = test->GetNumAudioStreams();
|
|
|
|
|
num_flexfec_streams_ = test->GetNumFlexfecStreams();
|
|
|
|
|
RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0);
|
2018-07-13 13:19:42 +02:00
|
|
|
Call::Config send_config(send_event_log_.get());
|
2018-11-13 15:10:33 +01:00
|
|
|
test->ModifySenderBitrateConfig(&send_config.bitrate_config);
|
2016-01-07 17:43:18 +01:00
|
|
|
if (num_audio_streams_ > 0) {
|
2017-08-22 04:02:52 -07:00
|
|
|
CreateFakeAudioDevices(test->CreateCapturer(), test->CreateRenderer());
|
|
|
|
|
test->OnFakeAudioDevicesCreated(fake_send_audio_device_.get(),
|
|
|
|
|
fake_recv_audio_device_.get());
|
2018-01-09 14:17:33 +01:00
|
|
|
apm_send_ = AudioProcessingBuilder().Create();
|
|
|
|
|
apm_recv_ = AudioProcessingBuilder().Create();
|
2018-01-11 13:52:30 +01:00
|
|
|
EXPECT_EQ(0, fake_send_audio_device_->Init());
|
|
|
|
|
EXPECT_EQ(0, fake_recv_audio_device_->Init());
|
2016-01-07 17:43:18 +01:00
|
|
|
AudioState::Config audio_state_config;
|
2016-11-17 06:48:48 -08:00
|
|
|
audio_state_config.audio_mixer = AudioMixerImpl::Create();
|
2017-08-22 04:02:52 -07:00
|
|
|
audio_state_config.audio_processing = apm_send_;
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
audio_state_config.audio_device_module = fake_send_audio_device_;
|
2017-08-22 04:02:52 -07:00
|
|
|
send_config.audio_state = AudioState::Create(audio_state_config);
|
2017-11-21 20:33:05 +01:00
|
|
|
fake_send_audio_device_->RegisterAudioCallback(
|
|
|
|
|
send_config.audio_state->audio_transport());
|
2017-08-22 04:02:52 -07:00
|
|
|
}
|
|
|
|
|
CreateSenderCall(send_config);
|
|
|
|
|
if (test->ShouldCreateReceivers()) {
|
2018-07-13 13:19:42 +02:00
|
|
|
Call::Config recv_config(recv_event_log_.get());
|
2018-11-13 15:10:33 +01:00
|
|
|
test->ModifyReceiverBitrateConfig(&recv_config.bitrate_config);
|
2017-08-22 04:02:52 -07:00
|
|
|
if (num_audio_streams_ > 0) {
|
|
|
|
|
AudioState::Config audio_state_config;
|
|
|
|
|
audio_state_config.audio_mixer = AudioMixerImpl::Create();
|
|
|
|
|
audio_state_config.audio_processing = apm_recv_;
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
audio_state_config.audio_device_module = fake_recv_audio_device_;
|
2017-08-22 04:02:52 -07:00
|
|
|
recv_config.audio_state = AudioState::Create(audio_state_config);
|
2017-11-21 20:33:05 +01:00
|
|
|
fake_recv_audio_device_->RegisterAudioCallback(
|
|
|
|
|
recv_config.audio_state->audio_transport());
|
|
|
|
|
}
|
2017-08-22 04:02:52 -07:00
|
|
|
CreateReceiverCall(recv_config);
|
|
|
|
|
}
|
|
|
|
|
test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
|
2019-11-13 11:19:53 +01:00
|
|
|
receive_transport_ = test->CreateReceiveTransport(task_queue());
|
2019-09-30 04:16:28 +02:00
|
|
|
send_transport_ =
|
2019-11-13 11:19:53 +01:00
|
|
|
test->CreateSendTransport(task_queue(), sender_call_.get());
|
2017-08-22 04:02:52 -07:00
|
|
|
|
|
|
|
|
if (test->ShouldCreateReceivers()) {
|
|
|
|
|
send_transport_->SetReceiver(receiver_call_->Receiver());
|
|
|
|
|
receive_transport_->SetReceiver(sender_call_->Receiver());
|
|
|
|
|
if (num_video_streams_ > 0)
|
|
|
|
|
receiver_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp);
|
|
|
|
|
if (num_audio_streams_ > 0)
|
|
|
|
|
receiver_call_->SignalChannelNetworkState(MediaType::AUDIO, kNetworkUp);
|
|
|
|
|
} else {
|
|
|
|
|
// Sender-only call delivers to itself.
|
|
|
|
|
send_transport_->SetReceiver(sender_call_->Receiver());
|
|
|
|
|
receive_transport_->SetReceiver(nullptr);
|
2016-01-07 17:43:18 +01:00
|
|
|
}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
CreateSendConfig(num_video_streams_, num_audio_streams_,
|
|
|
|
|
num_flexfec_streams_, send_transport_.get());
|
|
|
|
|
if (test->ShouldCreateReceivers()) {
|
|
|
|
|
CreateMatchingReceiveConfigs(receive_transport_.get());
|
|
|
|
|
}
|
|
|
|
|
if (num_video_streams_ > 0) {
|
2018-07-13 09:49:00 +02:00
|
|
|
test->ModifyVideoConfigs(GetVideoSendConfig(), &video_receive_configs_,
|
|
|
|
|
GetVideoEncoderConfig());
|
2017-08-22 04:02:52 -07:00
|
|
|
}
|
|
|
|
|
if (num_audio_streams_ > 0) {
|
|
|
|
|
test->ModifyAudioConfigs(&audio_send_config_, &audio_receive_configs_);
|
|
|
|
|
}
|
|
|
|
|
if (num_flexfec_streams_ > 0) {
|
|
|
|
|
test->ModifyFlexfecConfigs(&flexfec_receive_configs_);
|
|
|
|
|
}
|
2016-01-07 17:43:18 +01:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
if (num_flexfec_streams_ > 0) {
|
|
|
|
|
CreateFlexfecStreams();
|
|
|
|
|
test->OnFlexfecStreamsCreated(flexfec_receive_streams_);
|
|
|
|
|
}
|
|
|
|
|
if (num_video_streams_ > 0) {
|
|
|
|
|
CreateVideoStreams();
|
2018-07-13 13:29:03 +02:00
|
|
|
test->OnVideoStreamsCreated(GetVideoSendStream(), video_receive_streams_);
|
2017-08-22 04:02:52 -07:00
|
|
|
}
|
|
|
|
|
if (num_audio_streams_ > 0) {
|
|
|
|
|
CreateAudioStreams();
|
|
|
|
|
test->OnAudioStreamsCreated(audio_send_stream_, audio_receive_streams_);
|
|
|
|
|
}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
if (num_video_streams_ > 0) {
|
|
|
|
|
int width = kDefaultWidth;
|
|
|
|
|
int height = kDefaultHeight;
|
|
|
|
|
int frame_rate = kDefaultFramerate;
|
|
|
|
|
test->ModifyVideoCaptureStartResolution(&width, &height, &frame_rate);
|
2018-11-05 14:11:44 +01:00
|
|
|
test->ModifyVideoDegradationPreference(°radation_preference_);
|
2017-08-22 04:02:52 -07:00
|
|
|
CreateFrameGeneratorCapturer(frame_rate, width, height);
|
2018-07-13 13:29:03 +02:00
|
|
|
test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_);
|
2017-08-22 04:02:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Start();
|
|
|
|
|
});
|
2014-06-27 08:47:52 +00:00
|
|
|
|
|
|
|
|
test->PerformTest();
|
|
|
|
|
|
2019-11-13 11:19:53 +01:00
|
|
|
SendTask(RTC_FROM_HERE, task_queue(), [this, test]() {
|
2017-08-22 04:02:52 -07:00
|
|
|
Stop();
|
2017-09-14 14:46:47 +02:00
|
|
|
test->OnStreamsStopped();
|
2017-08-22 04:02:52 -07:00
|
|
|
DestroyStreams();
|
|
|
|
|
send_transport_.reset();
|
|
|
|
|
receive_transport_.reset();
|
2019-08-27 11:34:20 +02:00
|
|
|
|
2019-01-09 15:46:36 +01:00
|
|
|
frame_generator_capturer_ = nullptr;
|
2017-08-22 04:02:52 -07:00
|
|
|
DestroyCalls();
|
2019-08-27 11:34:20 +02:00
|
|
|
|
|
|
|
|
fake_send_audio_device_ = nullptr;
|
|
|
|
|
fake_recv_audio_device_ = nullptr;
|
2017-08-22 04:02:52 -07:00
|
|
|
});
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 10:43:20 +02:00
|
|
|
void CallTest::CreateCalls() {
|
|
|
|
|
CreateCalls(Call::Config(send_event_log_.get()),
|
|
|
|
|
Call::Config(recv_event_log_.get()));
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
void CallTest::CreateCalls(const Call::Config& sender_config,
|
|
|
|
|
const Call::Config& receiver_config) {
|
|
|
|
|
CreateSenderCall(sender_config);
|
|
|
|
|
CreateReceiverCall(receiver_config);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-13 10:43:20 +02:00
|
|
|
void CallTest::CreateSenderCall() {
|
|
|
|
|
CreateSenderCall(Call::Config(send_event_log_.get()));
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
void CallTest::CreateSenderCall(const Call::Config& config) {
|
2019-04-16 11:12:49 +02:00
|
|
|
auto sender_config = config;
|
2019-07-03 14:56:33 +02:00
|
|
|
sender_config.task_queue_factory = task_queue_factory_.get();
|
2019-04-16 11:12:49 +02:00
|
|
|
sender_config.network_state_predictor_factory =
|
|
|
|
|
network_state_predictor_factory_.get();
|
2019-04-30 14:23:51 +02:00
|
|
|
sender_config.network_controller_factory = network_controller_factory_.get();
|
2019-04-16 11:12:49 +02:00
|
|
|
sender_call_.reset(Call::Create(sender_config));
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateReceiverCall(const Call::Config& config) {
|
2019-07-03 14:56:33 +02:00
|
|
|
auto receiver_config = config;
|
|
|
|
|
receiver_config.task_queue_factory = task_queue_factory_.get();
|
|
|
|
|
receiver_call_.reset(Call::Create(receiver_config));
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-22 10:49:27 +02:00
|
|
|
void CallTest::DestroyCalls() {
|
2016-01-07 17:43:18 +01:00
|
|
|
sender_call_.reset();
|
|
|
|
|
receiver_call_.reset();
|
2015-10-22 10:49:27 +02:00
|
|
|
}
|
|
|
|
|
|
2017-12-21 18:02:59 +01:00
|
|
|
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);
|
|
|
|
|
*video_config = VideoSendStream::Config(send_transport);
|
2018-04-19 09:04:13 +02:00
|
|
|
video_config->encoder_settings.encoder_factory = &fake_encoder_factory_;
|
2018-11-08 10:02:56 -08:00
|
|
|
video_config->encoder_settings.bitrate_allocator_factory =
|
|
|
|
|
bitrate_allocator_factory_.get();
|
Reland "Reland "Move rtp-specific config out of EncoderSettings.""
This reverts commit 6c2c13af06b32778b86950681758a7970d1c5d9e.
Reason for revert: Intend to investigate and fix perf problems.
Original change's description:
> Revert "Reland "Move rtp-specific config out of EncoderSettings.""
>
> This reverts commit 04dd1768625eb2241d1fb97fd0137897e703e266.
>
> Reason for revert: Regression in ramp up perf tests.
>
> Original change's description:
> > Reland "Move rtp-specific config out of EncoderSettings."
> >
> > This is a reland of bc900cb1d1810fcf678fe41cf1e3966daa39c88c
> >
> > Original change's description:
> > > Move rtp-specific config out of EncoderSettings.
> > >
> > > In VideoSendStream::Config, move payload_name and payload_type from
> > > EncoderSettings to Rtp.
> > >
> > > EncoderSettings now contains configuration for VideoStreamEncoder only,
> > > and should perhaps be renamed in a follow up cl. It's no longer
> > > passed as an argument to VideoCodecInitializer::SetupCodec.
> > >
> > > The latter then needs a different way to know the codec type,
> > > which is provided by a new codec_type member in VideoEncoderConfig.
> > >
> > > Bug: webrtc:8830
> > > Change-Id: Ifcc691aef1ee6a95e43c0452c5e630d92a511cd6
> > > Reviewed-on: https://webrtc-review.googlesource.com/62062
> > > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#22532}
> >
> > Bug: webrtc:8830
> > Change-Id: If88ef7d57cdaa4fae3c7b2a97ea5a6e1b833e019
> > Reviewed-on: https://webrtc-review.googlesource.com/63721
> > Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Commit-Queue: Niels Moller <nisse@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22595}
>
> TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
>
> Bug: webrtc:8830,chromium:827080
> Change-Id: Iaaf146de91ec5c0d741b8efdf143f7e173084fef
> Reviewed-on: https://webrtc-review.googlesource.com/65520
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Reviewed-by: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22677}
TBR=brandtr@webrtc.org,magjed@webrtc.org,nisse@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:8830, chromium:827080
Change-Id: I9b62987bf5daced90dfeb3ebb6739c80117c487f
Reviewed-on: https://webrtc-review.googlesource.com/66862
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22751}
2018-04-05 15:36:51 +02:00
|
|
|
video_config->rtp.payload_name = "FAKE";
|
|
|
|
|
video_config->rtp.payload_type = kFakeVideoSendPayloadType;
|
2018-12-12 11:17:43 +01:00
|
|
|
video_config->rtp.extmap_allow_mixed = true;
|
Reland "Delete test/constants.h"
This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.
Reason for revert: Failing tests fixed.
Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}
TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
|
|
|
AddRtpExtensionByUri(RtpExtension::kTransportSequenceNumberUri,
|
|
|
|
|
&video_config->rtp.extensions);
|
|
|
|
|
AddRtpExtensionByUri(RtpExtension::kVideoContentTypeUri,
|
|
|
|
|
&video_config->rtp.extensions);
|
2019-02-19 13:01:31 +01:00
|
|
|
AddRtpExtensionByUri(RtpExtension::kGenericFrameDescriptorUri00,
|
|
|
|
|
&video_config->rtp.extensions);
|
|
|
|
|
AddRtpExtensionByUri(RtpExtension::kGenericFrameDescriptorUri01,
|
Reland "Delete test/constants.h"
This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.
Reason for revert: Failing tests fixed.
Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}
TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
|
|
|
&video_config->rtp.extensions);
|
2018-07-13 13:29:03 +02:00
|
|
|
if (video_encoder_configs_.empty()) {
|
|
|
|
|
video_encoder_configs_.emplace_back();
|
|
|
|
|
FillEncoderConfiguration(kVideoCodecGeneric, num_video_streams,
|
|
|
|
|
&video_encoder_configs_.back());
|
|
|
|
|
}
|
2017-12-21 18:02:59 +01:00
|
|
|
for (size_t i = 0; i < num_video_streams; ++i)
|
|
|
|
|
video_config->rtp.ssrcs.push_back(kVideoSendSsrcs[num_used_ssrcs + i]);
|
Reland "Delete test/constants.h"
This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.
Reason for revert: Failing tests fixed.
Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}
TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
|
|
|
AddRtpExtensionByUri(RtpExtension::kVideoRotationUri,
|
|
|
|
|
&video_config->rtp.extensions);
|
|
|
|
|
AddRtpExtensionByUri(RtpExtension::kColorSpaceUri,
|
|
|
|
|
&video_config->rtp.extensions);
|
2017-12-21 18:02:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateAudioAndFecSendConfigs(size_t num_audio_streams,
|
|
|
|
|
size_t num_flexfec_streams,
|
|
|
|
|
Transport* send_transport) {
|
2016-11-28 15:21:39 -08:00
|
|
|
RTC_DCHECK_LE(num_audio_streams, 1);
|
|
|
|
|
RTC_DCHECK_LE(num_flexfec_streams, 1);
|
2016-01-07 17:43:18 +01:00
|
|
|
if (num_audio_streams > 0) {
|
2019-11-26 09:19:40 -08:00
|
|
|
AudioSendStream::Config audio_send_config(send_transport);
|
2018-07-13 13:29:03 +02:00
|
|
|
audio_send_config.rtp.ssrc = kAudioSendSsrc;
|
|
|
|
|
audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
|
2017-11-16 10:54:58 +01:00
|
|
|
kAudioSendPayloadType, {"opus", 48000, 2, {{"stereo", "1"}}});
|
2018-07-13 13:29:03 +02:00
|
|
|
audio_send_config.encoder_factory = audio_encoder_factory_;
|
|
|
|
|
SetAudioConfig(audio_send_config);
|
2016-01-07 17:43:18 +01:00
|
|
|
}
|
2016-11-15 07:10:52 -08:00
|
|
|
|
|
|
|
|
// TODO(brandtr): Update this when we support multistream protection.
|
|
|
|
|
if (num_flexfec_streams > 0) {
|
2018-07-13 13:29:03 +02:00
|
|
|
SetSendFecConfig({kVideoSendSsrcs[0]});
|
2016-11-15 07:10:52 -08:00
|
|
|
}
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 13:29:03 +02:00
|
|
|
void CallTest::SetAudioConfig(const AudioSendStream::Config& config) {
|
|
|
|
|
audio_send_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.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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::SetReceiveUlpFecConfig(
|
|
|
|
|
VideoReceiveStream::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;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 18:02:59 +01:00
|
|
|
void CallTest::CreateSendConfig(size_t num_video_streams,
|
|
|
|
|
size_t num_audio_streams,
|
|
|
|
|
size_t num_flexfec_streams,
|
|
|
|
|
Transport* send_transport) {
|
|
|
|
|
if (num_video_streams > 0) {
|
2018-07-13 13:29:03 +02:00
|
|
|
video_send_configs_.clear();
|
|
|
|
|
video_send_configs_.emplace_back(nullptr);
|
|
|
|
|
CreateVideoSendConfig(&video_send_configs_.back(), num_video_streams, 0,
|
2017-12-21 18:02:59 +01:00
|
|
|
send_transport);
|
2016-01-07 17:43:18 +01:00
|
|
|
}
|
2017-12-21 18:02:59 +01:00
|
|
|
CreateAudioAndFecSendConfigs(num_audio_streams, num_flexfec_streams,
|
|
|
|
|
send_transport);
|
|
|
|
|
}
|
2016-01-07 17:43:18 +01:00
|
|
|
|
2018-07-13 13:29:03 +02:00
|
|
|
void CallTest::CreateMatchingVideoReceiveConfigs(
|
2017-12-21 18:02:59 +01:00
|
|
|
const VideoSendStream::Config& video_send_config,
|
|
|
|
|
Transport* rtcp_send_transport) {
|
2018-07-13 13:29:03 +02:00
|
|
|
CreateMatchingVideoReceiveConfigs(video_send_config, rtcp_send_transport,
|
2018-09-28 09:07:24 +02:00
|
|
|
true, &fake_decoder_factory_, absl::nullopt,
|
|
|
|
|
false, 0);
|
2018-07-13 13:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateMatchingVideoReceiveConfigs(
|
|
|
|
|
const VideoSendStream::Config& video_send_config,
|
|
|
|
|
Transport* rtcp_send_transport,
|
|
|
|
|
bool send_side_bwe,
|
2018-09-28 09:07:24 +02:00
|
|
|
VideoDecoderFactory* decoder_factory,
|
2018-07-13 13:29:03 +02:00
|
|
|
absl::optional<size_t> decode_sub_stream,
|
|
|
|
|
bool receiver_reference_time_report,
|
|
|
|
|
int rtp_history_ms) {
|
|
|
|
|
AddMatchingVideoReceiveConfigs(
|
|
|
|
|
&video_receive_configs_, video_send_config, rtcp_send_transport,
|
2018-09-28 09:07:24 +02:00
|
|
|
send_side_bwe, decoder_factory, decode_sub_stream,
|
|
|
|
|
receiver_reference_time_report, rtp_history_ms);
|
2018-07-13 13:29:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::AddMatchingVideoReceiveConfigs(
|
|
|
|
|
std::vector<VideoReceiveStream::Config>* receive_configs,
|
|
|
|
|
const VideoSendStream::Config& video_send_config,
|
|
|
|
|
Transport* rtcp_send_transport,
|
|
|
|
|
bool send_side_bwe,
|
2018-09-28 09:07:24 +02:00
|
|
|
VideoDecoderFactory* decoder_factory,
|
2018-07-13 13:29:03 +02:00
|
|
|
absl::optional<size_t> decode_sub_stream,
|
|
|
|
|
bool receiver_reference_time_report,
|
|
|
|
|
int rtp_history_ms) {
|
2017-12-21 18:02:59 +01:00
|
|
|
RTC_DCHECK(!video_send_config.rtp.ssrcs.empty());
|
2018-07-13 13:29:03 +02:00
|
|
|
VideoReceiveStream::Config default_config(rtcp_send_transport);
|
|
|
|
|
default_config.rtp.transport_cc = send_side_bwe;
|
|
|
|
|
default_config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
|
2017-12-21 18:02:59 +01:00
|
|
|
for (const RtpExtension& extension : video_send_config.rtp.extensions)
|
2018-07-13 13:29:03 +02:00
|
|
|
default_config.rtp.extensions.push_back(extension);
|
|
|
|
|
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 =
|
|
|
|
|
receiver_reference_time_report;
|
|
|
|
|
default_config.renderer = &fake_renderer_;
|
|
|
|
|
|
2017-12-21 18:02:59 +01:00
|
|
|
for (size_t i = 0; i < video_send_config.rtp.ssrcs.size(); ++i) {
|
2018-07-13 13:29:03 +02:00
|
|
|
VideoReceiveStream::Config video_recv_config(default_config.Copy());
|
|
|
|
|
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_send_config.rtp.payload_type;
|
|
|
|
|
}
|
|
|
|
|
video_recv_config.rtp.remote_ssrc = video_send_config.rtp.ssrcs[i];
|
|
|
|
|
VideoReceiveStream::Decoder decoder;
|
|
|
|
|
|
2018-09-28 09:07:24 +02:00
|
|
|
decoder.payload_type = video_send_config.rtp.payload_type;
|
|
|
|
|
decoder.video_format = SdpVideoFormat(video_send_config.rtp.payload_name);
|
2018-07-13 13:29:03 +02:00
|
|
|
// Force fake decoders on non-selected simulcast streams.
|
|
|
|
|
if (!decode_sub_stream || i == *decode_sub_stream) {
|
2018-09-28 09:07:24 +02:00
|
|
|
decoder.decoder_factory = decoder_factory;
|
2018-07-13 13:29:03 +02:00
|
|
|
} else {
|
2018-09-28 09:07:24 +02:00
|
|
|
decoder.decoder_factory = &fake_decoder_factory_;
|
2018-07-13 13:29:03 +02:00
|
|
|
}
|
|
|
|
|
video_recv_config.decoders.push_back(decoder);
|
|
|
|
|
receive_configs->emplace_back(std::move(video_recv_config));
|
2017-12-21 18:02:59 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateMatchingAudioAndFecConfigs(
|
|
|
|
|
Transport* rtcp_send_transport) {
|
2016-11-28 15:21:39 -08:00
|
|
|
RTC_DCHECK_GE(1, num_audio_streams_);
|
2016-01-07 17:43:18 +01:00
|
|
|
if (num_audio_streams_ == 1) {
|
2018-07-13 13:29:03 +02:00
|
|
|
CreateMatchingAudioConfigs(rtcp_send_transport, "");
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
2016-11-15 07:10:52 -08:00
|
|
|
|
|
|
|
|
// TODO(brandtr): Update this when we support multistream protection.
|
|
|
|
|
RTC_DCHECK(num_flexfec_streams_ <= 1);
|
|
|
|
|
if (num_flexfec_streams_ == 1) {
|
2018-07-13 13:29:03 +02:00
|
|
|
CreateMatchingFecConfig(rtcp_send_transport, *GetVideoSendConfig());
|
2018-07-13 09:49:00 +02:00
|
|
|
for (const RtpExtension& extension : GetVideoSendConfig()->rtp.extensions)
|
2018-07-13 13:29:03 +02:00
|
|
|
GetFlexFecConfig()->rtp_header_extensions.push_back(extension);
|
2016-11-15 07:10:52 -08:00
|
|
|
}
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 13:29:03 +02:00
|
|
|
void CallTest::CreateMatchingAudioConfigs(Transport* transport,
|
|
|
|
|
std::string sync_group) {
|
|
|
|
|
audio_receive_configs_.push_back(CreateMatchingAudioConfig(
|
|
|
|
|
audio_send_config_, audio_decoder_factory_, transport, sync_group));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AudioReceiveStream::Config CallTest::CreateMatchingAudioConfig(
|
|
|
|
|
const AudioSendStream::Config& send_config,
|
|
|
|
|
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
|
|
|
|
|
Transport* transport,
|
|
|
|
|
std::string sync_group) {
|
|
|
|
|
AudioReceiveStream::Config audio_config;
|
|
|
|
|
audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
|
|
|
|
|
audio_config.rtcp_send_transport = transport;
|
|
|
|
|
audio_config.rtp.remote_ssrc = send_config.rtp.ssrc;
|
|
|
|
|
audio_config.rtp.transport_cc =
|
|
|
|
|
send_config.send_codec_spec
|
|
|
|
|
? send_config.send_codec_spec->transport_cc_enabled
|
|
|
|
|
: false;
|
|
|
|
|
audio_config.rtp.extensions = send_config.rtp.extensions;
|
|
|
|
|
audio_config.decoder_factory = audio_decoder_factory;
|
|
|
|
|
audio_config.decoder_map = {{kAudioSendPayloadType, {"opus", 48000, 2}}};
|
|
|
|
|
audio_config.sync_group = sync_group;
|
|
|
|
|
return audio_config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateMatchingFecConfig(
|
|
|
|
|
Transport* transport,
|
|
|
|
|
const VideoSendStream::Config& send_config) {
|
|
|
|
|
FlexfecReceiveStream::Config config(transport);
|
|
|
|
|
config.payload_type = send_config.rtp.flexfec.payload_type;
|
|
|
|
|
config.remote_ssrc = send_config.rtp.flexfec.ssrc;
|
|
|
|
|
config.protected_media_ssrcs = send_config.rtp.flexfec.protected_media_ssrcs;
|
|
|
|
|
config.local_ssrc = kReceiverLocalVideoSsrc;
|
|
|
|
|
if (!video_receive_configs_.empty())
|
|
|
|
|
video_receive_configs_[0].rtp.protected_by_flexfec = true;
|
|
|
|
|
flexfec_receive_configs_.push_back(config);
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 18:02:59 +01:00
|
|
|
void CallTest::CreateMatchingReceiveConfigs(Transport* rtcp_send_transport) {
|
|
|
|
|
video_receive_configs_.clear();
|
2018-07-13 13:29:03 +02:00
|
|
|
for (VideoSendStream::Config& video_send_config : video_send_configs_) {
|
|
|
|
|
CreateMatchingVideoReceiveConfigs(video_send_config, rtcp_send_transport);
|
2017-12-21 18:02:59 +01:00
|
|
|
}
|
|
|
|
|
CreateMatchingAudioAndFecConfigs(rtcp_send_transport);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-10 10:54:47 -08:00
|
|
|
void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
|
2016-10-02 23:45:26 -07:00
|
|
|
float speed,
|
|
|
|
|
int framerate,
|
|
|
|
|
int width,
|
|
|
|
|
int height) {
|
2018-07-13 13:29:03 +02:00
|
|
|
video_sources_.clear();
|
2019-04-18 10:58:56 +02:00
|
|
|
auto frame_generator_capturer =
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<test::FrameGeneratorCapturer>(
|
2019-04-18 10:58:56 +02:00
|
|
|
clock,
|
|
|
|
|
test::FrameGenerator::CreateSquareGenerator(
|
|
|
|
|
width, height, absl::nullopt, absl::nullopt),
|
|
|
|
|
framerate * speed, *task_queue_factory_);
|
|
|
|
|
frame_generator_capturer_ = frame_generator_capturer.get();
|
|
|
|
|
frame_generator_capturer->Init();
|
|
|
|
|
video_sources_.push_back(std::move(frame_generator_capturer));
|
2018-07-13 09:49:00 +02:00
|
|
|
ConnectVideoSourcesToStreams();
|
2016-02-10 10:54:47 -08:00
|
|
|
}
|
|
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
void CallTest::CreateFrameGeneratorCapturer(int framerate,
|
|
|
|
|
int width,
|
|
|
|
|
int height) {
|
2018-07-13 13:29:03 +02:00
|
|
|
video_sources_.clear();
|
2019-04-18 10:58:56 +02:00
|
|
|
auto frame_generator_capturer =
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<test::FrameGeneratorCapturer>(
|
2019-04-18 10:58:56 +02:00
|
|
|
clock_,
|
|
|
|
|
test::FrameGenerator::CreateSquareGenerator(
|
|
|
|
|
width, height, absl::nullopt, absl::nullopt),
|
|
|
|
|
framerate, *task_queue_factory_);
|
|
|
|
|
frame_generator_capturer_ = frame_generator_capturer.get();
|
|
|
|
|
frame_generator_capturer->Init();
|
|
|
|
|
video_sources_.push_back(std::move(frame_generator_capturer));
|
2018-07-13 09:49:00 +02:00
|
|
|
ConnectVideoSourcesToStreams();
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
2015-07-28 08:20:59 -07:00
|
|
|
|
2017-03-23 03:40:03 -07:00
|
|
|
void CallTest::CreateFakeAudioDevices(
|
2018-03-07 14:44:00 +01:00
|
|
|
std::unique_ptr<TestAudioDeviceModule::Capturer> capturer,
|
|
|
|
|
std::unique_ptr<TestAudioDeviceModule::Renderer> renderer) {
|
2019-06-12 11:49:17 +00:00
|
|
|
fake_send_audio_device_ = TestAudioDeviceModule::Create(
|
|
|
|
|
task_queue_factory_.get(), std::move(capturer), nullptr, 1.f);
|
|
|
|
|
fake_recv_audio_device_ = TestAudioDeviceModule::Create(
|
|
|
|
|
task_queue_factory_.get(), nullptr, std::move(renderer), 1.f);
|
2016-01-07 17:43:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateVideoStreams() {
|
|
|
|
|
RTC_DCHECK(video_receive_streams_.empty());
|
2018-07-13 09:49:00 +02:00
|
|
|
CreateVideoSendStreams();
|
2015-12-21 03:14:00 -08:00
|
|
|
for (size_t i = 0; i < video_receive_configs_.size(); ++i) {
|
2016-06-10 17:58:01 +02:00
|
|
|
video_receive_streams_.push_back(receiver_call_->CreateVideoReceiveStream(
|
|
|
|
|
video_receive_configs_[i].Copy()));
|
2014-06-30 13:19:09 +00:00
|
|
|
}
|
2017-08-02 07:39:07 -07:00
|
|
|
|
|
|
|
|
AssociateFlexfecStreamsWithVideoStreams();
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 09:49:00 +02:00
|
|
|
void CallTest::CreateVideoSendStreams() {
|
2018-07-13 13:29:03 +02:00
|
|
|
RTC_DCHECK(video_send_streams_.empty());
|
|
|
|
|
|
|
|
|
|
// We currently only support testing external fec controllers with a single
|
|
|
|
|
// VideoSendStream.
|
|
|
|
|
if (fec_controller_factory_.get()) {
|
|
|
|
|
RTC_DCHECK_LE(video_send_configs_.size(), 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(http://crbug/818127):
|
|
|
|
|
// Remove this workaround when ALR is not screenshare-specific.
|
|
|
|
|
std::list<size_t> streams_creation_order;
|
|
|
|
|
for (size_t i = 0; i < video_send_configs_.size(); ++i) {
|
|
|
|
|
// If dual streams are created, add the screenshare stream last.
|
|
|
|
|
if (video_encoder_configs_[i].content_type ==
|
|
|
|
|
VideoEncoderConfig::ContentType::kScreen) {
|
|
|
|
|
streams_creation_order.push_back(i);
|
|
|
|
|
} else {
|
|
|
|
|
streams_creation_order.push_front(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
video_send_streams_.resize(video_send_configs_.size(), nullptr);
|
|
|
|
|
|
|
|
|
|
for (size_t i : streams_creation_order) {
|
|
|
|
|
if (fec_controller_factory_.get()) {
|
|
|
|
|
video_send_streams_[i] = sender_call_->CreateVideoSendStream(
|
|
|
|
|
video_send_configs_[i].Copy(), video_encoder_configs_[i].Copy(),
|
|
|
|
|
fec_controller_factory_->CreateFecController());
|
|
|
|
|
} else {
|
|
|
|
|
video_send_streams_[i] = sender_call_->CreateVideoSendStream(
|
|
|
|
|
video_send_configs_[i].Copy(), video_encoder_configs_[i].Copy());
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::CreateVideoSendStream(const VideoEncoderConfig& encoder_config) {
|
2018-07-13 13:29:03 +02:00
|
|
|
RTC_DCHECK(video_send_streams_.empty());
|
|
|
|
|
video_send_streams_.push_back(sender_call_->CreateVideoSendStream(
|
|
|
|
|
GetVideoSendConfig()->Copy(), encoder_config.Copy()));
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
2016-01-07 17:43:18 +01:00
|
|
|
void CallTest::CreateAudioStreams() {
|
2017-12-21 18:02:59 +01:00
|
|
|
RTC_DCHECK(audio_send_stream_ == nullptr);
|
|
|
|
|
RTC_DCHECK(audio_receive_streams_.empty());
|
2016-01-07 17:43:18 +01:00
|
|
|
audio_send_stream_ = sender_call_->CreateAudioSendStream(audio_send_config_);
|
|
|
|
|
for (size_t i = 0; i < audio_receive_configs_.size(); ++i) {
|
|
|
|
|
audio_receive_streams_.push_back(
|
|
|
|
|
receiver_call_->CreateAudioReceiveStream(audio_receive_configs_[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 07:10:52 -08:00
|
|
|
void CallTest::CreateFlexfecStreams() {
|
|
|
|
|
for (size_t i = 0; i < flexfec_receive_configs_.size(); ++i) {
|
|
|
|
|
flexfec_receive_streams_.push_back(
|
|
|
|
|
receiver_call_->CreateFlexfecReceiveStream(
|
|
|
|
|
flexfec_receive_configs_[i]));
|
|
|
|
|
}
|
2017-08-02 07:39:07 -07:00
|
|
|
|
|
|
|
|
AssociateFlexfecStreamsWithVideoStreams();
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-13 09:49:00 +02:00
|
|
|
void CallTest::ConnectVideoSourcesToStreams() {
|
2018-07-13 13:29:03 +02:00
|
|
|
for (size_t i = 0; i < video_sources_.size(); ++i)
|
2018-12-18 16:08:11 +01:00
|
|
|
video_send_streams_[i]->SetSource(video_sources_[i].get(),
|
2018-07-13 13:29:03 +02:00
|
|
|
degradation_preference_);
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-08-02 07:39:07 -07:00
|
|
|
void CallTest::AssociateFlexfecStreamsWithVideoStreams() {
|
|
|
|
|
// All FlexFEC streams protect all of the video streams.
|
|
|
|
|
for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) {
|
|
|
|
|
for (VideoReceiveStream* video_recv_stream : video_receive_streams_) {
|
|
|
|
|
video_recv_stream->AddSecondarySink(flexfec_recv_stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::DissociateFlexfecStreamsFromVideoStreams() {
|
|
|
|
|
for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) {
|
|
|
|
|
for (VideoReceiveStream* video_recv_stream : video_receive_streams_) {
|
|
|
|
|
video_recv_stream->RemoveSecondarySink(flexfec_recv_stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-15 07:10:52 -08:00
|
|
|
}
|
|
|
|
|
|
2017-08-09 01:52:36 -07:00
|
|
|
void CallTest::Start() {
|
2018-07-13 09:49:00 +02:00
|
|
|
StartVideoStreams();
|
2017-08-09 01:52:36 -07:00
|
|
|
if (audio_send_stream_) {
|
|
|
|
|
audio_send_stream_->Start();
|
|
|
|
|
}
|
|
|
|
|
for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
|
|
|
|
|
audio_recv_stream->Start();
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::StartVideoStreams() {
|
2018-07-13 13:29:03 +02:00
|
|
|
for (VideoSendStream* video_send_stream : video_send_streams_)
|
|
|
|
|
video_send_stream->Start();
|
2018-07-13 09:49:00 +02:00
|
|
|
for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
|
|
|
|
|
video_recv_stream->Start();
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-09 01:52:36 -07:00
|
|
|
void CallTest::Stop() {
|
|
|
|
|
for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
|
|
|
|
|
audio_recv_stream->Stop();
|
|
|
|
|
if (audio_send_stream_) {
|
|
|
|
|
audio_send_stream_->Stop();
|
|
|
|
|
}
|
2018-07-13 13:29:03 +02:00
|
|
|
StopVideoStreams();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::StopVideoStreams() {
|
|
|
|
|
for (VideoSendStream* video_send_stream : video_send_streams_)
|
|
|
|
|
video_send_stream->Stop();
|
2017-08-09 01:52:36 -07:00
|
|
|
for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
|
|
|
|
|
video_recv_stream->Stop();
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
void CallTest::DestroyStreams() {
|
2017-08-02 07:39:07 -07:00
|
|
|
DissociateFlexfecStreamsFromVideoStreams();
|
|
|
|
|
|
2016-01-07 17:43:18 +01:00
|
|
|
if (audio_send_stream_)
|
|
|
|
|
sender_call_->DestroyAudioSendStream(audio_send_stream_);
|
|
|
|
|
audio_send_stream_ = nullptr;
|
|
|
|
|
for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
|
|
|
|
|
receiver_call_->DestroyAudioReceiveStream(audio_recv_stream);
|
2017-01-27 06:47:55 -08:00
|
|
|
|
2018-07-13 09:49:00 +02:00
|
|
|
DestroyVideoSendStreams();
|
2017-03-07 04:21:04 -08:00
|
|
|
|
2017-01-27 06:47:55 -08:00
|
|
|
for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
|
|
|
|
|
receiver_call_->DestroyVideoReceiveStream(video_recv_stream);
|
2016-01-07 17:43:18 +01:00
|
|
|
|
2016-11-15 07:10:52 -08:00
|
|
|
for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
|
|
|
|
|
receiver_call_->DestroyFlexfecReceiveStream(flexfec_recv_stream);
|
|
|
|
|
|
|
|
|
|
video_receive_streams_.clear();
|
2019-10-10 12:42:41 +02:00
|
|
|
video_sources_.clear();
|
2014-06-27 08:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-13 09:49:00 +02:00
|
|
|
void CallTest::DestroyVideoSendStreams() {
|
2018-07-13 13:29:03 +02:00
|
|
|
for (VideoSendStream* video_send_stream : video_send_streams_)
|
|
|
|
|
sender_call_->DestroyVideoSendStream(video_send_stream);
|
|
|
|
|
video_send_streams_.clear();
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
2017-08-09 01:52:36 -07:00
|
|
|
void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) {
|
|
|
|
|
frame_generator_capturer_->SetFakeRotation(rotation);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-13 09:49:00 +02:00
|
|
|
void CallTest::SetVideoDegradation(DegradationPreference preference) {
|
2018-07-13 13:29:03 +02:00
|
|
|
GetVideoSendStream()->SetSource(frame_generator_capturer_, preference);
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoSendStream::Config* CallTest::GetVideoSendConfig() {
|
2018-07-13 13:29:03 +02:00
|
|
|
return &video_send_configs_[0];
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::SetVideoSendConfig(const VideoSendStream::Config& config) {
|
2018-07-13 13:29:03 +02:00
|
|
|
video_send_configs_.clear();
|
|
|
|
|
video_send_configs_.push_back(config.Copy());
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig* CallTest::GetVideoEncoderConfig() {
|
2018-07-13 13:29:03 +02:00
|
|
|
return &video_encoder_configs_[0];
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::SetVideoEncoderConfig(const VideoEncoderConfig& config) {
|
2018-07-13 13:29:03 +02:00
|
|
|
video_encoder_configs_.clear();
|
|
|
|
|
video_encoder_configs_.push_back(config.Copy());
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoSendStream* CallTest::GetVideoSendStream() {
|
2018-07-13 13:29:03 +02:00
|
|
|
return video_send_streams_[0];
|
|
|
|
|
}
|
|
|
|
|
FlexfecReceiveStream::Config* CallTest::GetFlexFecConfig() {
|
|
|
|
|
return &flexfec_receive_configs_[0];
|
2018-07-13 09:49:00 +02:00
|
|
|
}
|
|
|
|
|
|
Reland "Delete test/constants.h"
This reverts commit 4f36b7a478c2763463c7a9ea970548ec68bc3ea6.
Reason for revert: Failing tests fixed.
Original change's description:
> Revert "Delete test/constants.h"
>
> This reverts commit 389b1672a32f2dd49af6c6ed40e8ddf394b986de.
>
> Reason for revert: Causes failure (and empty result list) in CallPerfTest.PadsToMinTransmitBitrate
>
> Original change's description:
> > Delete test/constants.h
> >
> > It's not possible to use constants.h for all RTP extensions
> > after the number of extensions exceeds 14, which is the maximum
> > number of one-byte RTP extensions. This is because some extensions
> > would have to be assigned a number greater than 14, even if the
> > test only involves 14 extensions or less.
> >
> > For uniformity's sake, this CL also edits some files to use an
> > enum as the files involved in this CL, rather than free-floating
> > const-ints.
> >
> > Bug: webrtc:10288
> > Change-Id: Ib5e58ad72c4d3756f4c4f6521f140ec59617f3f5
> > Reviewed-on: https://webrtc-review.googlesource.com/c/123048
> > Commit-Queue: Elad Alon <eladalon@webrtc.org>
> > Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#26728}
>
> TBR=danilchap@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
>
> Bug: webrtc:10288, chromium:933127
> Change-Id: If1de0bd8992137c52bf0b877b3cb0a2bafc809d4
> Reviewed-on: https://webrtc-review.googlesource.com/c/123381
> Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
> Reviewed-by: Oleh Prypin <oprypin@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26744}
TBR=danilchap@webrtc.org,oprypin@webrtc.org,kwiberg@webrtc.org,eladalon@webrtc.org,sprang@webrtc.org
Change-Id: I65e391325d3a6df6db3c0739185e2002e70fb954
Bug: webrtc:10288, chromium:933127
Reviewed-on: https://webrtc-review.googlesource.com/c/123384
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26750}
2019-02-18 23:45:57 +01:00
|
|
|
absl::optional<RtpExtension> CallTest::GetRtpExtensionByUri(
|
|
|
|
|
const std::string& uri) const {
|
|
|
|
|
for (const auto& extension : rtp_extensions_) {
|
|
|
|
|
if (extension.uri == uri) {
|
|
|
|
|
return extension;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return absl::nullopt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CallTest::AddRtpExtensionByUri(
|
|
|
|
|
const std::string& uri,
|
|
|
|
|
std::vector<RtpExtension>* extensions) const {
|
|
|
|
|
const absl::optional<RtpExtension> extension = GetRtpExtensionByUri(uri);
|
|
|
|
|
if (extension) {
|
|
|
|
|
extensions->push_back(*extension);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 18:02:59 +01:00
|
|
|
constexpr size_t CallTest::kNumSsrcs;
|
2016-10-02 23:45:26 -07:00
|
|
|
const int CallTest::kDefaultWidth;
|
|
|
|
|
const int CallTest::kDefaultHeight;
|
|
|
|
|
const int CallTest::kDefaultFramerate;
|
2015-12-10 13:02:50 +01:00
|
|
|
const int CallTest::kDefaultTimeoutMs = 30 * 1000;
|
|
|
|
|
const int CallTest::kLongTimeoutMs = 120 * 1000;
|
2017-12-21 18:02:59 +01:00
|
|
|
const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {
|
|
|
|
|
0xBADCAFD, 0xBADCAFE, 0xBADCAFF, 0xBADCB00, 0xBADCB01, 0xBADCB02};
|
|
|
|
|
const uint32_t CallTest::kVideoSendSsrcs[kNumSsrcs] = {
|
|
|
|
|
0xC0FFED, 0xC0FFEE, 0xC0FFEF, 0xC0FFF0, 0xC0FFF1, 0xC0FFF2};
|
2016-01-07 17:43:18 +01:00
|
|
|
const uint32_t CallTest::kAudioSendSsrc = 0xDEADBEEF;
|
2016-11-15 07:10:52 -08:00
|
|
|
const uint32_t CallTest::kFlexfecSendSsrc = 0xBADBEEF;
|
2016-01-07 17:43:18 +01:00
|
|
|
const uint32_t CallTest::kReceiverLocalVideoSsrc = 0x123456;
|
|
|
|
|
const uint32_t CallTest::kReceiverLocalAudioSsrc = 0x1234567;
|
2014-06-27 08:47:52 +00:00
|
|
|
const int CallTest::kNackRtpHistoryMs = 1000;
|
|
|
|
|
|
2017-04-10 16:57:57 -07:00
|
|
|
const std::map<uint8_t, MediaType> CallTest::payload_type_map_ = {
|
|
|
|
|
{CallTest::kVideoSendPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kFakeVideoSendPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kSendRtxPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kRedPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kRtxRedPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kUlpfecPayloadType, MediaType::VIDEO},
|
|
|
|
|
{CallTest::kFlexfecPayloadType, MediaType::VIDEO},
|
2019-03-04 18:59:32 +01:00
|
|
|
{CallTest::kAudioSendPayloadType, MediaType::AUDIO}};
|
2017-04-10 16:57:57 -07:00
|
|
|
|
2018-07-13 13:19:42 +02:00
|
|
|
BaseTest::BaseTest() {}
|
2017-03-21 03:24:27 -07:00
|
|
|
|
2018-07-13 13:19:42 +02:00
|
|
|
BaseTest::BaseTest(int timeout_ms) : RtpRtcpObserver(timeout_ms) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
|
|
|
|
BaseTest::~BaseTest() {}
|
|
|
|
|
|
2018-03-07 14:44:00 +01:00
|
|
|
std::unique_ptr<TestAudioDeviceModule::Capturer> BaseTest::CreateCapturer() {
|
|
|
|
|
return TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000);
|
2017-03-23 03:40:03 -07:00
|
|
|
}
|
|
|
|
|
|
2018-03-07 14:44:00 +01:00
|
|
|
std::unique_ptr<TestAudioDeviceModule::Renderer> BaseTest::CreateRenderer() {
|
|
|
|
|
return TestAudioDeviceModule::CreateDiscardRenderer(48000);
|
2017-03-23 03:40:03 -07:00
|
|
|
}
|
|
|
|
|
|
2018-03-07 14:44:00 +01:00
|
|
|
void BaseTest::OnFakeAudioDevicesCreated(
|
|
|
|
|
TestAudioDeviceModule* send_audio_device,
|
|
|
|
|
TestAudioDeviceModule* recv_audio_device) {}
|
2017-03-23 03:40:03 -07:00
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void BaseTest::ModifySenderBitrateConfig(BitrateConstraints* bitrate_config) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void BaseTest::ModifyReceiverBitrateConfig(BitrateConstraints* bitrate_config) {
|
|
|
|
|
}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
|
|
|
|
void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) {}
|
|
|
|
|
|
2019-09-30 04:16:28 +02:00
|
|
|
std::unique_ptr<PacketTransport> BaseTest::CreateSendTransport(
|
|
|
|
|
TaskQueueBase* task_queue,
|
2017-08-22 04:02:52 -07:00
|
|
|
Call* sender_call) {
|
2019-09-30 04:16:28 +02:00
|
|
|
return std::make_unique<PacketTransport>(
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue, sender_call, this, test::PacketTransport::kSender,
|
2018-08-20 13:30:39 +02:00
|
|
|
CallTest::payload_type_map_,
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<FakeNetworkPipe>(
|
2018-10-08 12:28:56 +02:00
|
|
|
Clock::GetRealTimeClock(),
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<SimulatedNetwork>(BuiltInNetworkBehaviorConfig())));
|
2016-01-08 06:47:13 -08:00
|
|
|
}
|
|
|
|
|
|
2019-09-30 04:16:28 +02:00
|
|
|
std::unique_ptr<PacketTransport> BaseTest::CreateReceiveTransport(
|
|
|
|
|
TaskQueueBase* task_queue) {
|
|
|
|
|
return std::make_unique<PacketTransport>(
|
2017-08-22 04:02:52 -07:00
|
|
|
task_queue, nullptr, this, test::PacketTransport::kReceiver,
|
2018-08-20 13:30:39 +02:00
|
|
|
CallTest::payload_type_map_,
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<FakeNetworkPipe>(
|
2018-10-08 12:28:56 +02:00
|
|
|
Clock::GetRealTimeClock(),
|
2019-09-17 17:06:18 +02:00
|
|
|
std::make_unique<SimulatedNetwork>(BuiltInNetworkBehaviorConfig())));
|
2016-01-08 06:47:13 -08:00
|
|
|
}
|
2015-10-27 08:29:42 -07:00
|
|
|
|
2016-01-07 17:43:18 +01:00
|
|
|
size_t BaseTest::GetNumVideoStreams() const {
|
2014-06-27 08:47:52 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 17:43:18 +01:00
|
|
|
size_t BaseTest::GetNumAudioStreams() const {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 07:10:52 -08:00
|
|
|
size_t BaseTest::GetNumFlexfecStreams() const {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
void BaseTest::ModifyVideoConfigs(
|
2014-06-30 13:19:09 +00:00
|
|
|
VideoSendStream::Config* send_config,
|
|
|
|
|
std::vector<VideoReceiveStream::Config>* receive_configs,
|
2015-12-21 03:14:00 -08:00
|
|
|
VideoEncoderConfig* encoder_config) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
void BaseTest::ModifyVideoCaptureStartResolution(int* width,
|
|
|
|
|
int* heigt,
|
|
|
|
|
int* frame_rate) {}
|
|
|
|
|
|
2018-11-05 14:11:44 +01:00
|
|
|
void BaseTest::ModifyVideoDegradationPreference(
|
|
|
|
|
DegradationPreference* degradation_preference) {}
|
|
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
void BaseTest::OnVideoStreamsCreated(
|
2014-06-30 13:19:09 +00:00
|
|
|
VideoSendStream* send_stream,
|
2015-12-21 03:14:00 -08:00
|
|
|
const std::vector<VideoReceiveStream*>& receive_streams) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
2016-01-07 17:43:18 +01:00
|
|
|
void BaseTest::ModifyAudioConfigs(
|
|
|
|
|
AudioSendStream::Config* send_config,
|
|
|
|
|
std::vector<AudioReceiveStream::Config>* receive_configs) {}
|
|
|
|
|
|
|
|
|
|
void BaseTest::OnAudioStreamsCreated(
|
|
|
|
|
AudioSendStream* send_stream,
|
|
|
|
|
const std::vector<AudioReceiveStream*>& receive_streams) {}
|
|
|
|
|
|
2016-11-15 07:10:52 -08:00
|
|
|
void BaseTest::ModifyFlexfecConfigs(
|
|
|
|
|
std::vector<FlexfecReceiveStream::Config>* receive_configs) {}
|
|
|
|
|
|
|
|
|
|
void BaseTest::OnFlexfecStreamsCreated(
|
|
|
|
|
const std::vector<FlexfecReceiveStream*>& receive_streams) {}
|
|
|
|
|
|
2014-06-27 08:47:52 +00:00
|
|
|
void BaseTest::OnFrameGeneratorCapturerCreated(
|
|
|
|
|
FrameGeneratorCapturer* frame_generator_capturer) {}
|
|
|
|
|
|
2017-09-14 14:46:47 +02:00
|
|
|
void BaseTest::OnStreamsStopped() {}
|
2017-03-23 03:40:03 -07:00
|
|
|
|
2018-07-13 13:19:42 +02:00
|
|
|
SendTest::SendTest(int timeout_ms) : BaseTest(timeout_ms) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
|
|
|
|
bool SendTest::ShouldCreateReceivers() const {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-21 03:24:27 -07:00
|
|
|
EndToEndTest::EndToEndTest() {}
|
|
|
|
|
|
2018-07-13 13:19:42 +02:00
|
|
|
EndToEndTest::EndToEndTest(int timeout_ms) : BaseTest(timeout_ms) {}
|
2014-06-27 08:47:52 +00:00
|
|
|
|
|
|
|
|
bool EndToEndTest::ShouldCreateReceivers() const {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|