2013-09-10 09:26:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/rampup_tests.h"
|
2015-12-21 03:14:00 -08:00
|
|
|
|
2019-04-11 15:18:18 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2019-01-07 10:21:47 -08:00
|
|
|
#include "absl/memory/memory.h"
|
2019-04-11 15:18:18 +02:00
|
|
|
#include "api/task_queue/default_task_queue_factory.h"
|
|
|
|
|
#include "api/task_queue/task_queue_factory.h"
|
2018-08-20 13:30:39 +02:00
|
|
|
#include "call/fake_network_pipe.h"
|
2018-10-15 13:24:31 +02:00
|
|
|
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
2019-04-11 15:18:18 +02:00
|
|
|
#include "logging/rtc_event_log/rtc_event_log_factory.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2018-10-15 13:24:31 +02:00
|
|
|
#include "rtc_base/flags.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/logging.h"
|
|
|
|
|
#include "rtc_base/platform_thread.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/string_encode.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/encoder_settings.h"
|
2019-02-15 10:54:55 +01:00
|
|
|
#include "test/field_trial.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/gtest.h"
|
|
|
|
|
#include "test/testsupport/perf_test.h"
|
2013-09-10 09:26:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2013-09-11 10:14:56 +00:00
|
|
|
namespace {
|
2014-07-08 13:59:46 +00:00
|
|
|
|
2015-10-05 14:59:41 +02:00
|
|
|
static const int64_t kPollIntervalMs = 20;
|
2017-02-21 07:28:31 -08:00
|
|
|
static const int kExpectedHighVideoBitrateBps = 80000;
|
2016-12-05 08:23:40 -08:00
|
|
|
static const int kExpectedHighAudioBitrateBps = 30000;
|
|
|
|
|
static const int kLowBandwidthLimitBps = 20000;
|
2018-02-23 11:34:18 +01:00
|
|
|
// Set target detected bitrate to slightly larger than the target bitrate to
|
|
|
|
|
// avoid flakiness.
|
|
|
|
|
static const int kLowBitrateMarginBps = 2000;
|
2013-09-10 09:26:25 +00:00
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
std::vector<uint32_t> GenerateSsrcs(size_t num_streams, uint32_t ssrc_offset) {
|
2014-07-08 13:59:46 +00:00
|
|
|
std::vector<uint32_t> ssrcs;
|
|
|
|
|
for (size_t i = 0; i != num_streams; ++i)
|
|
|
|
|
ssrcs.push_back(static_cast<uint32_t>(ssrc_offset + i));
|
|
|
|
|
return ssrcs;
|
|
|
|
|
}
|
|
|
|
|
} // namespace
|
2014-03-19 08:43:57 +00:00
|
|
|
|
2018-10-18 11:35:32 +02:00
|
|
|
WEBRTC_DEFINE_string(ramp_dump_name,
|
|
|
|
|
"",
|
|
|
|
|
"Filename for dumped received RTP stream.");
|
2018-10-15 13:24:31 +02:00
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
RampUpTester::RampUpTester(size_t num_video_streams,
|
|
|
|
|
size_t num_audio_streams,
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t num_flexfec_streams,
|
2015-09-28 03:57:14 -07:00
|
|
|
unsigned int start_bitrate_bps,
|
2017-01-27 06:43:18 -08:00
|
|
|
int64_t min_run_time_ms,
|
2015-09-28 03:57:14 -07:00
|
|
|
const std::string& extension_type,
|
|
|
|
|
bool rtx,
|
2017-01-27 06:43:18 -08:00
|
|
|
bool red,
|
|
|
|
|
bool report_perf_stats)
|
2015-09-28 03:57:14 -07:00
|
|
|
: EndToEndTest(test::CallTest::kLongTimeoutMs),
|
|
|
|
|
clock_(Clock::GetRealTimeClock()),
|
2015-12-21 03:14:00 -08:00
|
|
|
num_video_streams_(num_video_streams),
|
|
|
|
|
num_audio_streams_(num_audio_streams),
|
2017-02-21 07:28:31 -08:00
|
|
|
num_flexfec_streams_(num_flexfec_streams),
|
2015-09-28 03:57:14 -07:00
|
|
|
rtx_(rtx),
|
|
|
|
|
red_(red),
|
2017-03-09 06:27:02 -08:00
|
|
|
report_perf_stats_(report_perf_stats),
|
2016-07-26 04:44:06 -07:00
|
|
|
sender_call_(nullptr),
|
2015-09-28 03:57:14 -07:00
|
|
|
send_stream_(nullptr),
|
2017-06-27 07:06:52 -07:00
|
|
|
send_transport_(nullptr),
|
2018-08-21 21:01:00 +02:00
|
|
|
send_simulated_network_(nullptr),
|
2015-09-28 03:57:14 -07:00
|
|
|
start_bitrate_bps_(start_bitrate_bps),
|
2017-01-27 06:43:18 -08:00
|
|
|
min_run_time_ms_(min_run_time_ms),
|
2014-07-08 13:59:46 +00:00
|
|
|
expected_bitrate_bps_(0),
|
2015-10-05 14:03:22 +02:00
|
|
|
test_start_ms_(-1),
|
2015-09-28 03:57:14 -07:00
|
|
|
ramp_up_finished_ms_(-1),
|
|
|
|
|
extension_type_(extension_type),
|
2015-12-21 03:14:00 -08:00
|
|
|
video_ssrcs_(GenerateSsrcs(num_video_streams_, 100)),
|
|
|
|
|
video_rtx_ssrcs_(GenerateSsrcs(num_video_streams_, 200)),
|
|
|
|
|
audio_ssrcs_(GenerateSsrcs(num_audio_streams_, 300)),
|
2015-11-26 17:45:47 +01:00
|
|
|
poller_thread_(&BitrateStatsPollingThread,
|
|
|
|
|
this,
|
2016-07-26 04:44:06 -07:00
|
|
|
"BitrateStatsPollingThread") {
|
2017-02-21 07:28:31 -08:00
|
|
|
if (red_)
|
|
|
|
|
EXPECT_EQ(0u, num_flexfec_streams_);
|
2016-01-14 10:00:21 +01:00
|
|
|
EXPECT_LE(num_audio_streams_, 1u);
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RampUpTester::~RampUpTester() {}
|
|
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void RampUpTester::ModifySenderBitrateConfig(
|
|
|
|
|
BitrateConstraints* bitrate_config) {
|
2014-07-08 13:59:46 +00:00
|
|
|
if (start_bitrate_bps_ != 0) {
|
2018-11-13 15:10:33 +01:00
|
|
|
bitrate_config->start_bitrate_bps = start_bitrate_bps_;
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2018-11-13 15:10:33 +01:00
|
|
|
bitrate_config->min_bitrate_bps = 10000;
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
void RampUpTester::OnVideoStreamsCreated(
|
2015-09-28 03:57:14 -07:00
|
|
|
VideoSendStream* send_stream,
|
|
|
|
|
const std::vector<VideoReceiveStream*>& receive_streams) {
|
|
|
|
|
send_stream_ = send_stream;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
test::PacketTransport* RampUpTester::CreateSendTransport(
|
|
|
|
|
test::SingleThreadedTaskQueueForTesting* task_queue,
|
|
|
|
|
Call* sender_call) {
|
2018-08-21 21:01:00 +02:00
|
|
|
auto network = absl::make_unique<SimulatedNetwork>(forward_transport_config_);
|
|
|
|
|
send_simulated_network_ = network.get();
|
2017-04-10 16:57:57 -07:00
|
|
|
send_transport_ = new test::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
|
|
|
test::CallTest::payload_type_map_,
|
2018-08-21 21:01:00 +02:00
|
|
|
absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
|
|
|
|
|
std::move(network)));
|
2016-01-08 06:47:13 -08:00
|
|
|
return send_transport_;
|
2015-10-27 08:29:42 -07:00
|
|
|
}
|
|
|
|
|
|
2016-01-12 15:51:22 +01:00
|
|
|
size_t RampUpTester::GetNumVideoStreams() const {
|
|
|
|
|
return num_video_streams_;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
size_t RampUpTester::GetNumAudioStreams() const {
|
|
|
|
|
return num_audio_streams_;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t RampUpTester::GetNumFlexfecStreams() const {
|
|
|
|
|
return num_flexfec_streams_;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
class RampUpTester::VideoStreamFactory
|
|
|
|
|
: public VideoEncoderConfig::VideoStreamFactoryInterface {
|
|
|
|
|
public:
|
|
|
|
|
VideoStreamFactory() {}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::vector<VideoStream> CreateEncoderStreams(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const VideoEncoderConfig& encoder_config) override {
|
|
|
|
|
std::vector<VideoStream> streams =
|
|
|
|
|
test::CreateVideoStreams(width, height, encoder_config);
|
|
|
|
|
if (encoder_config.number_of_streams == 1) {
|
|
|
|
|
streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
|
|
|
|
|
}
|
|
|
|
|
return streams;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
void RampUpTester::ModifyVideoConfigs(
|
2015-09-28 03:57:14 -07:00
|
|
|
VideoSendStream::Config* send_config,
|
|
|
|
|
std::vector<VideoReceiveStream::Config>* receive_configs,
|
|
|
|
|
VideoEncoderConfig* encoder_config) {
|
|
|
|
|
send_config->suspend_below_min_bitrate = true;
|
2016-10-02 23:45:26 -07:00
|
|
|
encoder_config->number_of_streams = num_video_streams_;
|
|
|
|
|
encoder_config->max_bitrate_bps = 2000000;
|
|
|
|
|
encoder_config->video_stream_factory =
|
|
|
|
|
new rtc::RefCountedObject<RampUpTester::VideoStreamFactory>();
|
2015-12-21 03:14:00 -08:00
|
|
|
if (num_video_streams_ == 1) {
|
2015-09-28 03:57:14 -07:00
|
|
|
// For single stream rampup until 1mbps
|
|
|
|
|
expected_bitrate_bps_ = kSingleStreamTargetBps;
|
|
|
|
|
} else {
|
2018-08-27 14:12:27 +02:00
|
|
|
// To ensure simulcast rate allocation.
|
|
|
|
|
send_config->rtp.payload_name = "VP8";
|
|
|
|
|
encoder_config->codec_type = kVideoCodecVP8;
|
2016-10-02 23:45:26 -07:00
|
|
|
std::vector<VideoStream> streams = test::CreateVideoStreams(
|
|
|
|
|
test::CallTest::kDefaultWidth, test::CallTest::kDefaultHeight,
|
|
|
|
|
*encoder_config);
|
2018-08-27 14:12:27 +02:00
|
|
|
// 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.
|
2016-10-02 23:45:26 -07:00
|
|
|
expected_bitrate_bps_ = streams.back().min_bitrate_bps;
|
|
|
|
|
for (size_t i = 0; i < streams.size() - 1; ++i) {
|
|
|
|
|
expected_bitrate_bps_ += streams[i].target_bitrate_bps;
|
2013-12-04 10:24:26 +00:00
|
|
|
}
|
2013-09-10 09:26:25 +00:00
|
|
|
}
|
2015-09-28 03:57:14 -07:00
|
|
|
|
|
|
|
|
send_config->rtp.extensions.clear();
|
|
|
|
|
|
|
|
|
|
bool remb;
|
2015-11-20 18:05:48 -08:00
|
|
|
bool transport_cc;
|
2016-05-26 11:24:55 -07:00
|
|
|
if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
|
2015-09-28 03:57:14 -07:00
|
|
|
remb = true;
|
2015-11-20 18:05:48 -08:00
|
|
|
transport_cc = false;
|
2015-09-28 03:57:14 -07:00
|
|
|
send_config->rtp.extensions.push_back(
|
|
|
|
|
RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
|
2016-05-26 11:24:55 -07:00
|
|
|
} else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
|
2015-09-28 03:57:14 -07:00
|
|
|
remb = false;
|
2015-11-20 18:05:48 -08:00
|
|
|
transport_cc = true;
|
2015-09-28 03:57:14 -07:00
|
|
|
send_config->rtp.extensions.push_back(RtpExtension(
|
|
|
|
|
extension_type_.c_str(), kTransportSequenceNumberExtensionId));
|
2014-07-08 13:59:46 +00:00
|
|
|
} else {
|
2015-09-28 03:57:14 -07:00
|
|
|
remb = true;
|
2015-11-20 18:05:48 -08:00
|
|
|
transport_cc = false;
|
2015-09-28 03:57:14 -07:00
|
|
|
send_config->rtp.extensions.push_back(RtpExtension(
|
|
|
|
|
extension_type_.c_str(), kTransmissionTimeOffsetExtensionId));
|
2013-09-10 09:26:25 +00:00
|
|
|
}
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
send_config->rtp.nack.rtp_history_ms = test::CallTest::kNackRtpHistoryMs;
|
2015-12-21 03:14:00 -08:00
|
|
|
send_config->rtp.ssrcs = video_ssrcs_;
|
2015-09-28 03:57:14 -07:00
|
|
|
if (rtx_) {
|
|
|
|
|
send_config->rtp.rtx.payload_type = test::CallTest::kSendRtxPayloadType;
|
2015-12-21 03:14:00 -08:00
|
|
|
send_config->rtp.rtx.ssrcs = video_rtx_ssrcs_;
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
if (red_) {
|
2016-10-04 23:28:39 -07:00
|
|
|
send_config->rtp.ulpfec.ulpfec_payload_type =
|
2015-09-28 03:57:14 -07:00
|
|
|
test::CallTest::kUlpfecPayloadType;
|
2016-10-04 23:28:39 -07:00
|
|
|
send_config->rtp.ulpfec.red_payload_type = test::CallTest::kRedPayloadType;
|
2016-11-17 04:18:37 -08:00
|
|
|
if (rtx_) {
|
|
|
|
|
send_config->rtp.ulpfec.red_rtx_payload_type =
|
|
|
|
|
test::CallTest::kRtxRedPayloadType;
|
|
|
|
|
}
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t i = 0;
|
|
|
|
|
for (VideoReceiveStream::Config& recv_config : *receive_configs) {
|
|
|
|
|
recv_config.rtp.remb = remb;
|
2015-11-20 18:05:48 -08:00
|
|
|
recv_config.rtp.transport_cc = transport_cc;
|
2015-09-28 03:57:14 -07:00
|
|
|
recv_config.rtp.extensions = send_config->rtp.extensions;
|
2018-08-27 14:12:27 +02:00
|
|
|
recv_config.decoders.reserve(1);
|
|
|
|
|
recv_config.decoders[0].payload_type = send_config->rtp.payload_type;
|
2018-09-11 15:56:04 +02:00
|
|
|
recv_config.decoders[0].video_format =
|
|
|
|
|
SdpVideoFormat(send_config->rtp.payload_name);
|
2015-09-28 03:57:14 -07:00
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
recv_config.rtp.remote_ssrc = video_ssrcs_[i];
|
2015-09-28 03:57:14 -07:00
|
|
|
recv_config.rtp.nack.rtp_history_ms = send_config->rtp.nack.rtp_history_ms;
|
|
|
|
|
|
|
|
|
|
if (red_) {
|
2017-09-26 02:49:21 -07:00
|
|
|
recv_config.rtp.red_payload_type =
|
2016-10-04 23:28:39 -07:00
|
|
|
send_config->rtp.ulpfec.red_payload_type;
|
2017-09-26 02:49:21 -07:00
|
|
|
recv_config.rtp.ulpfec_payload_type =
|
2016-10-04 23:28:39 -07:00
|
|
|
send_config->rtp.ulpfec.ulpfec_payload_type;
|
2016-11-17 04:18:37 -08:00
|
|
|
if (rtx_) {
|
Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3007303002/ )
Reason for revert:
Identified a configuration problem in the video quality tests. Intend to fix and reland.
Original issue's description:
> Revert of Use RtxReceiveStream. (patchset #5 id:320001 of https://codereview.webrtc.org/3006063002/ )
>
> Reason for revert:
> This change appears to break ulpfec, with severe regressions, e.g., for webrtc_perf_test FullStackTest.ForemanCifPlr5Ulpfec
>
> Original issue's description:
> > Reland of Use RtxReceiveStream. (patchset #1 id:1 of https://codereview.webrtc.org/3010983002/ )
> >
> > Reason for revert:
> > Intend to fix perf failures and reland.
> >
> > Original issue's description:
> > > Revert of Use RtxReceiveStream. (patchset #5 id:80001 of https://codereview.webrtc.org/3008773002/ )
> > >
> > > Reason for revert:
> > > A few perf tests broken, including
> > >
> > > RampUpTest.UpDownUpAbsSendTimeSimulcastRedRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberRtx
> > > RampUpTest.UpDownUpTransportSequenceNumberPacketLoss
> > >
> > >
> > > Original issue's description:
> > > > Use RtxReceiveStream.
> > > >
> > > > This also has the beneficial side-effect that when a media stream
> > > > which is protected by FlexFEC receives an RTX retransmission, the
> > > > retransmitted media packet is passed into the FlexFEC machinery,
> > > > which should improve its ability to recover packets via FEC.
> > > >
> > > > BUG=webrtc:7135
> > > >
> > > > Review-Url: https://codereview.webrtc.org/3008773002
> > > > Cr-Commit-Position: refs/heads/master@{#19649}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/5c0f6c62ea3b1d2c43f8fc152961af27033475f7
> > >
> > > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:7135
> > >
> > > Review-Url: https://codereview.webrtc.org/3010983002
> > > Cr-Commit-Position: refs/heads/master@{#19653}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/3c39c0137afa274d1d524b150b50304b38a2847b
> >
> > TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/3006063002
> > Cr-Commit-Position: refs/heads/master@{#19715}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/35713eaf565c0fef07c8afc158d7b8fdf7ec3d78
>
> TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/3007303002
> Cr-Commit-Position: refs/heads/master@{#19744}
> Committed: https://chromium.googlesource.com/external/webrtc/+/8e7eee035178a7f10e19883681b5eaa4a7523107
TBR=brandtr@webrtc.org,danilchap@webrtc.org,stefan@webrtc.org,magjed@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/3012963002
Cr-Commit-Position: refs/heads/master@{#19765}
2017-09-11 02:32:16 -07:00
|
|
|
recv_config.rtp.rtx_associated_payload_types
|
|
|
|
|
[send_config->rtp.ulpfec.red_rtx_payload_type] =
|
|
|
|
|
send_config->rtp.ulpfec.red_payload_type;
|
2016-11-17 04:18:37 -08:00
|
|
|
}
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rtx_) {
|
Reland of Make RTX pt/apt reconfigurable by calling WebRtcVideoChannel2::SetRecvParameters. (patchset #1 id:1 of https://codereview.webrtc.org/2649323010/ )
Reason for revert:
Downstream project relied on changed struct.
Transition made possible by https://codereview.webrtc.org/2655243006/.
Original issue's description:
> Revert of Make RTX pt/apt reconfigurable by calling WebRtcVideoChannel2::SetRecvParameters. (patchset #7 id:160001 of https://codereview.webrtc.org/2646073004/ )
>
> Reason for revert:
> Breaks internal downstream project.
>
> Original issue's description:
> > Make RTX pt/apt reconfigurable by calling WebRtcVideoChannel2::SetRecvParameters.
> >
> > Prior to this CL, received RTX (associated) payload types were only configured
> > when WebRtcVideoChannel2::AddRecvStream was called. In the same method, the RTX
> > SSRC was set up.
> >
> > After this CL, the RTX (associated) payload types are set in
> > WebRtcVideoChannel2::SetRecvParameters, which is the appropriate place to set
> > them. The RTX SSRC is still set in WebRtcVideoChannel2::AddRecvStream, since
> > that is the code path that sets other SSRCs.
> >
> > As part of this fix, the VideoReceiveStream::Config::Rtp struct is changed.
> > We remove the possibility for each video payload type to have an associated
> > specific RTX SSRC. Although the config previously allowed for this, all payload
> > types always had the same RTX SSRC set, and the underlying RtpPayloadRegistry
> > did not support multiple SSRCs. This change to the config struct should thus not
> > have any functional impact. The change does however affect the RtcEventLog, since
> > that is used for storing the VideoReceiveStream::Configs. For simplicity,
> > this CL does not change the event log proto definitions, instead duplicating
> > the serialized RTX SSRCs such that they fit in the existing proto definition.
> >
> > BUG=webrtc:7011
> >
> > Review-Url: https://codereview.webrtc.org/2646073004
> > Cr-Commit-Position: refs/heads/master@{#16302}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/fe2bef39cd2a5c891a49f7320514fb04324dc66c
>
> TBR=stefan@webrtc.org,magjed@webrtc.org,terelius@webrtc.org,brandtr@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7011
>
> Review-Url: https://codereview.webrtc.org/2649323010
> Cr-Commit-Position: refs/heads/master@{#16307}
> Committed: https://chromium.googlesource.com/external/webrtc/+/e4974953ce0d03a60fae7659b199a6a62a79fa30
TBR=stefan@webrtc.org,magjed@webrtc.org,terelius@webrtc.org,kjellander@webrtc.org,kjellander@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
# NOTREECHECKS=true
# NOTRY=true
BUG=webrtc:7011
Review-Url: https://codereview.webrtc.org/2654163006
Cr-Commit-Position: refs/heads/master@{#16322}
2017-01-27 04:53:07 -08:00
|
|
|
recv_config.rtp.rtx_ssrc = video_rtx_ssrcs_[i];
|
|
|
|
|
recv_config.rtp
|
2017-08-25 04:44:25 -07:00
|
|
|
.rtx_associated_payload_types[send_config->rtp.rtx.payload_type] =
|
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
|
|
|
send_config->rtp.payload_type;
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
++i;
|
|
|
|
|
}
|
2017-02-21 07:28:31 -08:00
|
|
|
|
|
|
|
|
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.protected_media_ssrcs = {video_ssrcs_[0]};
|
|
|
|
|
}
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2013-09-10 09:26:25 +00:00
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
void RampUpTester::ModifyAudioConfigs(
|
|
|
|
|
AudioSendStream::Config* send_config,
|
|
|
|
|
std::vector<AudioReceiveStream::Config>* receive_configs) {
|
|
|
|
|
if (num_audio_streams_ == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-05-26 11:24:55 -07:00
|
|
|
EXPECT_NE(RtpExtension::kTimestampOffsetUri, extension_type_)
|
2016-01-14 10:00:21 +01:00
|
|
|
<< "Audio BWE not supported with toffset.";
|
2017-02-21 07:28:31 -08:00
|
|
|
EXPECT_NE(RtpExtension::kAbsSendTimeUri, extension_type_)
|
|
|
|
|
<< "Audio BWE not supported with abs-send-time.";
|
2016-01-14 10:00:21 +01:00
|
|
|
|
|
|
|
|
send_config->rtp.ssrc = audio_ssrcs_[0];
|
|
|
|
|
send_config->rtp.extensions.clear();
|
|
|
|
|
|
2016-11-07 09:29:22 -08:00
|
|
|
send_config->min_bitrate_bps = 6000;
|
|
|
|
|
send_config->max_bitrate_bps = 60000;
|
2016-07-26 04:44:06 -07:00
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
bool transport_cc = false;
|
2017-02-21 07:28:31 -08:00
|
|
|
if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
|
2016-01-14 10:00:21 +01:00
|
|
|
transport_cc = true;
|
|
|
|
|
send_config->rtp.extensions.push_back(RtpExtension(
|
|
|
|
|
extension_type_.c_str(), kTransportSequenceNumberExtensionId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (AudioReceiveStream::Config& recv_config : *receive_configs) {
|
|
|
|
|
recv_config.rtp.transport_cc = transport_cc;
|
|
|
|
|
recv_config.rtp.extensions = send_config->rtp.extensions;
|
|
|
|
|
recv_config.rtp.remote_ssrc = send_config->rtp.ssrc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-21 07:28:31 -08:00
|
|
|
void RampUpTester::ModifyFlexfecConfigs(
|
|
|
|
|
std::vector<FlexfecReceiveStream::Config>* receive_configs) {
|
|
|
|
|
if (num_flexfec_streams_ == 0)
|
|
|
|
|
return;
|
|
|
|
|
RTC_DCHECK_EQ(1, num_flexfec_streams_);
|
|
|
|
|
(*receive_configs)[0].payload_type = test::CallTest::kFlexfecPayloadType;
|
|
|
|
|
(*receive_configs)[0].remote_ssrc = test::CallTest::kFlexfecSendSsrc;
|
|
|
|
|
(*receive_configs)[0].protected_media_ssrcs = {video_ssrcs_[0]};
|
|
|
|
|
(*receive_configs)[0].local_ssrc = video_ssrcs_[0];
|
|
|
|
|
if (extension_type_ == RtpExtension::kAbsSendTimeUri) {
|
|
|
|
|
(*receive_configs)[0].transport_cc = false;
|
|
|
|
|
(*receive_configs)[0].rtp_header_extensions.push_back(
|
|
|
|
|
RtpExtension(extension_type_.c_str(), kAbsSendTimeExtensionId));
|
|
|
|
|
} else if (extension_type_ == RtpExtension::kTransportSequenceNumberUri) {
|
|
|
|
|
(*receive_configs)[0].transport_cc = true;
|
|
|
|
|
(*receive_configs)[0].rtp_header_extensions.push_back(RtpExtension(
|
|
|
|
|
extension_type_.c_str(), kTransportSequenceNumberExtensionId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
void RampUpTester::OnCallsCreated(Call* sender_call, Call* receiver_call) {
|
|
|
|
|
sender_call_ = sender_call;
|
2014-10-22 12:15:24 +00:00
|
|
|
}
|
2014-03-17 15:34:57 +00:00
|
|
|
|
2017-02-22 11:22:05 -08:00
|
|
|
void RampUpTester::BitrateStatsPollingThread(void* obj) {
|
|
|
|
|
static_cast<RampUpTester*>(obj)->PollStats();
|
2015-07-06 10:50:47 +02:00
|
|
|
}
|
|
|
|
|
|
2017-02-22 11:22:05 -08:00
|
|
|
void RampUpTester::PollStats() {
|
|
|
|
|
do {
|
|
|
|
|
if (sender_call_) {
|
|
|
|
|
Call::Stats stats = sender_call_->GetStats();
|
|
|
|
|
|
|
|
|
|
EXPECT_GE(expected_bitrate_bps_, 0);
|
|
|
|
|
if (stats.send_bandwidth_bps >= expected_bitrate_bps_ &&
|
|
|
|
|
(min_run_time_ms_ == -1 ||
|
|
|
|
|
clock_->TimeInMilliseconds() - test_start_ms_ >= min_run_time_ms_)) {
|
|
|
|
|
ramp_up_finished_ms_ = clock_->TimeInMilliseconds();
|
|
|
|
|
observation_complete_.Set();
|
|
|
|
|
}
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
2017-02-22 11:22:05 -08:00
|
|
|
} while (!stop_event_.Wait(kPollIntervalMs));
|
2015-09-24 15:06:57 +02:00
|
|
|
}
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
void RampUpTester::ReportResult(const std::string& measurement,
|
|
|
|
|
size_t value,
|
|
|
|
|
const std::string& units) const {
|
2014-07-08 13:59:46 +00:00
|
|
|
webrtc::test::PrintResult(
|
|
|
|
|
measurement, "",
|
2015-12-21 03:14:00 -08:00
|
|
|
::testing::UnitTest::GetInstance()->current_test_info()->name(), value,
|
|
|
|
|
units, false);
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2014-03-17 15:34:57 +00:00
|
|
|
|
2015-09-29 02:26:42 -07:00
|
|
|
void RampUpTester::AccumulateStats(const VideoSendStream::StreamStats& stream,
|
|
|
|
|
size_t* total_packets_sent,
|
|
|
|
|
size_t* total_sent,
|
|
|
|
|
size_t* padding_sent,
|
|
|
|
|
size_t* media_sent) const {
|
2015-09-28 03:57:14 -07:00
|
|
|
*total_packets_sent += stream.rtp_stats.transmitted.packets +
|
|
|
|
|
stream.rtp_stats.retransmitted.packets +
|
|
|
|
|
stream.rtp_stats.fec.packets;
|
|
|
|
|
*total_sent += stream.rtp_stats.transmitted.TotalBytes() +
|
|
|
|
|
stream.rtp_stats.retransmitted.TotalBytes() +
|
|
|
|
|
stream.rtp_stats.fec.TotalBytes();
|
|
|
|
|
*padding_sent += stream.rtp_stats.transmitted.padding_bytes +
|
|
|
|
|
stream.rtp_stats.retransmitted.padding_bytes +
|
|
|
|
|
stream.rtp_stats.fec.padding_bytes;
|
|
|
|
|
*media_sent += stream.rtp_stats.MediaPayloadBytes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RampUpTester::TriggerTestDone() {
|
2015-10-05 14:03:22 +02:00
|
|
|
RTC_DCHECK_GE(test_start_ms_, 0);
|
|
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
// TODO(holmer): Add audio send stats here too when those APIs are available.
|
2016-07-26 04:44:06 -07:00
|
|
|
if (!send_stream_)
|
|
|
|
|
return;
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
VideoSendStream::Stats send_stats = send_stream_->GetStats();
|
|
|
|
|
|
|
|
|
|
size_t total_packets_sent = 0;
|
|
|
|
|
size_t total_sent = 0;
|
|
|
|
|
size_t padding_sent = 0;
|
|
|
|
|
size_t media_sent = 0;
|
2015-12-21 03:14:00 -08:00
|
|
|
for (uint32_t ssrc : video_ssrcs_) {
|
2015-09-29 02:26:42 -07:00
|
|
|
AccumulateStats(send_stats.substreams[ssrc], &total_packets_sent,
|
|
|
|
|
&total_sent, &padding_sent, &media_sent);
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t rtx_total_packets_sent = 0;
|
|
|
|
|
size_t rtx_total_sent = 0;
|
|
|
|
|
size_t rtx_padding_sent = 0;
|
|
|
|
|
size_t rtx_media_sent = 0;
|
2015-12-21 03:14:00 -08:00
|
|
|
for (uint32_t rtx_ssrc : video_rtx_ssrcs_) {
|
2015-09-29 02:26:42 -07:00
|
|
|
AccumulateStats(send_stats.substreams[rtx_ssrc], &rtx_total_packets_sent,
|
|
|
|
|
&rtx_total_sent, &rtx_padding_sent, &rtx_media_sent);
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
2017-01-27 06:43:18 -08:00
|
|
|
if (report_perf_stats_) {
|
|
|
|
|
ReportResult("ramp-up-media-sent", media_sent, "bytes");
|
|
|
|
|
ReportResult("ramp-up-padding-sent", padding_sent, "bytes");
|
|
|
|
|
ReportResult("ramp-up-rtx-media-sent", rtx_media_sent, "bytes");
|
|
|
|
|
ReportResult("ramp-up-rtx-padding-sent", rtx_padding_sent, "bytes");
|
|
|
|
|
if (ramp_up_finished_ms_ >= 0) {
|
|
|
|
|
ReportResult("ramp-up-time", ramp_up_finished_ms_ - test_start_ms_,
|
|
|
|
|
"milliseconds");
|
|
|
|
|
}
|
|
|
|
|
ReportResult("ramp-up-average-network-latency",
|
|
|
|
|
send_transport_->GetAverageDelayMs(), "milliseconds");
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RampUpTester::PerformTest() {
|
2015-10-05 14:03:22 +02:00
|
|
|
test_start_ms_ = clock_->TimeInMilliseconds();
|
2015-11-26 17:45:47 +01:00
|
|
|
poller_thread_.Start();
|
2015-12-10 13:02:50 +01:00
|
|
|
EXPECT_TRUE(Wait()) << "Timed out while waiting for ramp-up to complete.";
|
2015-09-28 03:57:14 -07:00
|
|
|
TriggerTestDone();
|
2017-02-22 11:22:05 -08:00
|
|
|
stop_event_.Set();
|
2015-11-26 17:45:47 +01:00
|
|
|
poller_thread_.Stop();
|
2015-09-28 03:57:14 -07:00
|
|
|
}
|
|
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
RampUpDownUpTester::RampUpDownUpTester(size_t num_video_streams,
|
|
|
|
|
size_t num_audio_streams,
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t num_flexfec_streams,
|
2015-09-28 03:57:14 -07:00
|
|
|
unsigned int start_bitrate_bps,
|
|
|
|
|
const std::string& extension_type,
|
|
|
|
|
bool rtx,
|
2017-02-21 07:28:31 -08:00
|
|
|
bool red,
|
2017-03-09 06:27:02 -08:00
|
|
|
const std::vector<int>& loss_rates,
|
|
|
|
|
bool report_perf_stats)
|
2016-01-14 10:00:21 +01:00
|
|
|
: RampUpTester(num_video_streams,
|
|
|
|
|
num_audio_streams,
|
2017-02-21 07:28:31 -08:00
|
|
|
num_flexfec_streams,
|
2016-01-14 10:00:21 +01:00
|
|
|
start_bitrate_bps,
|
2017-01-27 06:43:18 -08:00
|
|
|
0,
|
2016-01-14 10:00:21 +01:00
|
|
|
extension_type,
|
|
|
|
|
rtx,
|
2017-01-27 06:43:18 -08:00
|
|
|
red,
|
2017-03-09 06:27:02 -08:00
|
|
|
report_perf_stats),
|
2017-04-01 06:51:09 -07:00
|
|
|
link_rates_({4 * GetExpectedHighBitrate() / (3 * 1000),
|
|
|
|
|
kLowBandwidthLimitBps / 1000,
|
|
|
|
|
4 * GetExpectedHighBitrate() / (3 * 1000), 0}),
|
2014-07-08 13:59:46 +00:00
|
|
|
test_state_(kFirstRampup),
|
2017-02-21 07:28:31 -08:00
|
|
|
next_state_(kTransitionToNextState),
|
2014-07-08 13:59:46 +00:00
|
|
|
state_start_ms_(clock_->TimeInMilliseconds()),
|
2015-09-28 03:57:14 -07:00
|
|
|
interval_start_ms_(clock_->TimeInMilliseconds()),
|
2017-02-21 07:28:31 -08:00
|
|
|
sent_bytes_(0),
|
|
|
|
|
loss_rates_(loss_rates) {
|
|
|
|
|
forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
|
|
|
|
|
forward_transport_config_.queue_delay_ms = 100;
|
|
|
|
|
forward_transport_config_.loss_percent = loss_rates_[test_state_];
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2014-03-13 13:31:21 +00:00
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
RampUpDownUpTester::~RampUpDownUpTester() {}
|
2014-03-06 07:19:28 +00:00
|
|
|
|
2017-02-22 11:22:05 -08:00
|
|
|
void RampUpDownUpTester::PollStats() {
|
|
|
|
|
do {
|
2017-10-20 10:37:47 +02:00
|
|
|
int transmit_bitrate_bps = 0;
|
|
|
|
|
bool suspended = false;
|
|
|
|
|
if (num_video_streams_ > 0) {
|
2017-02-22 11:22:05 -08:00
|
|
|
webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
|
2019-01-27 17:29:42 +01:00
|
|
|
for (const auto& it : stats.substreams) {
|
2017-02-22 11:22:05 -08:00
|
|
|
transmit_bitrate_bps += it.second.total_bitrate_bps;
|
|
|
|
|
}
|
2017-10-20 10:37:47 +02:00
|
|
|
suspended = stats.suspended;
|
|
|
|
|
}
|
|
|
|
|
if (num_audio_streams_ > 0 && sender_call_ != nullptr) {
|
2017-02-22 11:22:05 -08:00
|
|
|
// An audio send stream doesn't have bitrate stats, so the call send BW is
|
|
|
|
|
// currently used instead.
|
2017-10-20 10:37:47 +02:00
|
|
|
transmit_bitrate_bps = sender_call_->GetStats().send_bandwidth_bps;
|
2014-03-06 07:19:28 +00:00
|
|
|
}
|
2017-10-20 10:37:47 +02:00
|
|
|
EvolveTestState(transmit_bitrate_bps, suspended);
|
2017-02-22 11:22:05 -08:00
|
|
|
} while (!stop_event_.Wait(kPollIntervalMs));
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2014-03-06 07:19:28 +00:00
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void RampUpDownUpTester::ModifyReceiverBitrateConfig(
|
|
|
|
|
BitrateConstraints* bitrate_config) {
|
|
|
|
|
bitrate_config->min_bitrate_bps = 10000;
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2014-03-06 07:19:28 +00:00
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
std::string RampUpDownUpTester::GetModifierString() const {
|
2014-07-08 13:59:46 +00:00
|
|
|
std::string str("_");
|
2015-12-21 03:14:00 -08:00
|
|
|
if (num_video_streams_ > 0) {
|
2018-04-04 15:49:32 +02:00
|
|
|
str += rtc::ToString(num_video_streams_);
|
2015-12-21 03:14:00 -08:00
|
|
|
str += "stream";
|
|
|
|
|
str += (num_video_streams_ > 1 ? "s" : "");
|
|
|
|
|
str += "_";
|
|
|
|
|
}
|
|
|
|
|
if (num_audio_streams_ > 0) {
|
2018-04-04 15:49:32 +02:00
|
|
|
str += rtc::ToString(num_audio_streams_);
|
2015-12-21 03:14:00 -08:00
|
|
|
str += "stream";
|
|
|
|
|
str += (num_audio_streams_ > 1 ? "s" : "");
|
|
|
|
|
str += "_";
|
|
|
|
|
}
|
2015-09-28 03:57:14 -07:00
|
|
|
str += (rtx_ ? "" : "no");
|
2018-01-04 19:44:54 +01:00
|
|
|
str += "rtx_";
|
|
|
|
|
str += (red_ ? "" : "no");
|
|
|
|
|
str += "red";
|
2014-07-08 13:59:46 +00:00
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-05 08:23:40 -08:00
|
|
|
int RampUpDownUpTester::GetExpectedHighBitrate() const {
|
2017-01-09 04:19:24 -08:00
|
|
|
int expected_bitrate_bps = 0;
|
|
|
|
|
if (num_audio_streams_ > 0)
|
|
|
|
|
expected_bitrate_bps += kExpectedHighAudioBitrateBps;
|
|
|
|
|
if (num_video_streams_ > 0)
|
|
|
|
|
expected_bitrate_bps += kExpectedHighVideoBitrateBps;
|
|
|
|
|
return expected_bitrate_bps;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t RampUpDownUpTester::GetFecBytes() const {
|
|
|
|
|
size_t flex_fec_bytes = 0;
|
|
|
|
|
if (num_flexfec_streams_ > 0) {
|
|
|
|
|
webrtc::VideoSendStream::Stats stats = send_stream_->GetStats();
|
|
|
|
|
for (const auto& kv : stats.substreams)
|
|
|
|
|
flex_fec_bytes += kv.second.rtp_stats.fec.TotalBytes();
|
|
|
|
|
}
|
|
|
|
|
return flex_fec_bytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RampUpDownUpTester::ExpectingFec() const {
|
|
|
|
|
return num_flexfec_streams_ > 0 && forward_transport_config_.loss_percent > 0;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
void RampUpDownUpTester::EvolveTestState(int bitrate_bps, bool suspended) {
|
2014-07-08 13:59:46 +00:00
|
|
|
int64_t now = clock_->TimeInMilliseconds();
|
|
|
|
|
switch (test_state_) {
|
2017-02-21 07:28:31 -08:00
|
|
|
case kFirstRampup:
|
2015-09-28 03:57:14 -07:00
|
|
|
EXPECT_FALSE(suspended);
|
2016-12-05 08:23:40 -08:00
|
|
|
if (bitrate_bps >= GetExpectedHighBitrate()) {
|
2017-03-09 06:27:02 -08:00
|
|
|
if (report_perf_stats_) {
|
|
|
|
|
webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
|
|
|
|
|
"first_rampup", now - state_start_ms_, "ms",
|
|
|
|
|
false);
|
|
|
|
|
}
|
2017-02-21 07:28:31 -08:00
|
|
|
// Apply loss during the transition between states if FEC is enabled.
|
|
|
|
|
forward_transport_config_.loss_percent = loss_rates_[test_state_];
|
|
|
|
|
test_state_ = kTransitionToNextState;
|
|
|
|
|
next_state_ = kLowRate;
|
2014-03-06 07:19:28 +00:00
|
|
|
}
|
2014-07-08 13:59:46 +00:00
|
|
|
break;
|
|
|
|
|
case kLowRate: {
|
2016-07-26 04:44:06 -07:00
|
|
|
// Audio streams are never suspended.
|
|
|
|
|
bool check_suspend_state = num_video_streams_ > 0;
|
2018-02-23 11:34:18 +01:00
|
|
|
if (bitrate_bps < kLowBandwidthLimitBps + kLowBitrateMarginBps &&
|
2016-07-26 04:44:06 -07:00
|
|
|
suspended == check_suspend_state) {
|
2017-03-09 06:27:02 -08:00
|
|
|
if (report_perf_stats_) {
|
|
|
|
|
webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
|
|
|
|
|
"rampdown", now - state_start_ms_, "ms",
|
|
|
|
|
false);
|
|
|
|
|
}
|
2017-02-21 07:28:31 -08:00
|
|
|
// Apply loss during the transition between states if FEC is enabled.
|
|
|
|
|
forward_transport_config_.loss_percent = loss_rates_[test_state_];
|
|
|
|
|
test_state_ = kTransitionToNextState;
|
|
|
|
|
next_state_ = kSecondRampup;
|
2014-03-06 07:19:28 +00:00
|
|
|
}
|
2014-07-08 13:59:46 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2017-02-21 07:28:31 -08:00
|
|
|
case kSecondRampup:
|
2016-12-05 08:23:40 -08:00
|
|
|
if (bitrate_bps >= GetExpectedHighBitrate() && !suspended) {
|
2017-03-09 06:27:02 -08:00
|
|
|
if (report_perf_stats_) {
|
|
|
|
|
webrtc::test::PrintResult("ramp_up_down_up", GetModifierString(),
|
|
|
|
|
"second_rampup", now - state_start_ms_,
|
|
|
|
|
"ms", false);
|
|
|
|
|
ReportResult("ramp-up-down-up-average-network-latency",
|
|
|
|
|
send_transport_->GetAverageDelayMs(), "milliseconds");
|
|
|
|
|
}
|
2017-02-21 07:28:31 -08:00
|
|
|
// Apply loss during the transition between states if FEC is enabled.
|
|
|
|
|
forward_transport_config_.loss_percent = loss_rates_[test_state_];
|
|
|
|
|
test_state_ = kTransitionToNextState;
|
|
|
|
|
next_state_ = kTestEnd;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case kTestEnd:
|
|
|
|
|
observation_complete_.Set();
|
|
|
|
|
break;
|
|
|
|
|
case kTransitionToNextState:
|
|
|
|
|
if (!ExpectingFec() || GetFecBytes() > 0) {
|
|
|
|
|
test_state_ = next_state_;
|
|
|
|
|
forward_transport_config_.link_capacity_kbps = link_rates_[test_state_];
|
|
|
|
|
// No loss while ramping up and down as it may affect the BWE
|
|
|
|
|
// negatively, making the test flaky.
|
|
|
|
|
forward_transport_config_.loss_percent = 0;
|
|
|
|
|
state_start_ms_ = now;
|
|
|
|
|
interval_start_ms_ = now;
|
|
|
|
|
sent_bytes_ = 0;
|
2018-08-21 21:01:00 +02:00
|
|
|
send_simulated_network_->SetConfig(forward_transport_config_);
|
2014-03-06 07:19:28 +00:00
|
|
|
}
|
2014-07-08 13:59:46 +00:00
|
|
|
break;
|
2014-03-06 07:19:28 +00:00
|
|
|
}
|
2014-07-08 13:59:46 +00:00
|
|
|
}
|
2014-03-06 07:19:28 +00:00
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
class RampUpTest : public test::CallTest {
|
2015-09-24 15:06:57 +02:00
|
|
|
public:
|
2019-04-11 15:18:18 +02:00
|
|
|
RampUpTest()
|
|
|
|
|
: task_queue_factory_(CreateDefaultTaskQueueFactory()),
|
|
|
|
|
rtc_event_log_factory_(task_queue_factory_.get()) {
|
2018-10-15 13:24:31 +02:00
|
|
|
std::string dump_name(FLAG_ramp_dump_name);
|
|
|
|
|
if (!dump_name.empty()) {
|
2019-04-11 15:18:18 +02:00
|
|
|
send_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
|
|
|
|
|
RtcEventLog::EncodingType::Legacy);
|
|
|
|
|
recv_event_log_ = rtc_event_log_factory_.CreateRtcEventLog(
|
|
|
|
|
RtcEventLog::EncodingType::Legacy);
|
2018-10-15 13:24:31 +02:00
|
|
|
bool event_log_started =
|
|
|
|
|
send_event_log_->StartLogging(
|
|
|
|
|
absl::make_unique<RtcEventLogOutputFile>(
|
|
|
|
|
dump_name + ".send.rtc.dat", RtcEventLog::kUnlimitedOutput),
|
|
|
|
|
RtcEventLog::kImmediateOutput) &&
|
|
|
|
|
recv_event_log_->StartLogging(
|
|
|
|
|
absl::make_unique<RtcEventLogOutputFile>(
|
|
|
|
|
dump_name + ".recv.rtc.dat", RtcEventLog::kUnlimitedOutput),
|
|
|
|
|
RtcEventLog::kImmediateOutput);
|
|
|
|
|
RTC_DCHECK(event_log_started);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-11 15:18:18 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
|
|
|
|
|
RtcEventLogFactory rtc_event_log_factory_;
|
2015-09-24 15:06:57 +02:00
|
|
|
};
|
|
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
static const uint32_t kStartBitrateBps = 60000;
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, UpDownUpAbsSendTimeSimulcastRedRtx) {
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates = {0, 0, 0, 0};
|
|
|
|
|
RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
|
2017-03-09 06:27:02 -08:00
|
|
|
RtpExtension::kAbsSendTimeUri, true, true, loss_rates,
|
|
|
|
|
true);
|
2016-01-14 10:00:21 +01:00
|
|
|
RunBaseTest(&test);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-16 09:59:56 -08:00
|
|
|
// TODO(bugs.webrtc.org/8878)
|
|
|
|
|
#if defined(WEBRTC_MAC)
|
|
|
|
|
#define MAYBE_UpDownUpTransportSequenceNumberRtx \
|
|
|
|
|
DISABLED_UpDownUpTransportSequenceNumberRtx
|
|
|
|
|
#else
|
|
|
|
|
#define MAYBE_UpDownUpTransportSequenceNumberRtx \
|
|
|
|
|
UpDownUpTransportSequenceNumberRtx
|
|
|
|
|
#endif
|
|
|
|
|
TEST_F(RampUpTest, MAYBE_UpDownUpTransportSequenceNumberRtx) {
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates = {0, 0, 0, 0};
|
|
|
|
|
RampUpDownUpTester test(3, 0, 0, kStartBitrateBps,
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension::kTransportSequenceNumberUri, true,
|
2017-03-09 06:27:02 -08:00
|
|
|
false, loss_rates, true);
|
2017-02-21 07:28:31 -08:00
|
|
|
RunBaseTest(&test);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 06:27:02 -08:00
|
|
|
// TODO(holmer): Tests which don't report perf stats should be moved to a
|
|
|
|
|
// different executable since they per definition are not perf tests.
|
2017-10-10 12:12:53 -07:00
|
|
|
// This test is disabled because it crashes on Linux, and is flaky on other
|
|
|
|
|
// platforms. See: crbug.com/webrtc/7919
|
|
|
|
|
TEST_F(RampUpTest, DISABLED_UpDownUpTransportSequenceNumberPacketLoss) {
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates = {20, 0, 0, 0};
|
|
|
|
|
RampUpDownUpTester test(1, 0, 1, kStartBitrateBps,
|
|
|
|
|
RtpExtension::kTransportSequenceNumberUri, true,
|
2017-03-09 06:27:02 -08:00
|
|
|
false, loss_rates, false);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2015-04-21 20:24:50 +08:00
|
|
|
}
|
2016-01-14 10:00:21 +01:00
|
|
|
|
2018-02-12 15:16:02 -08:00
|
|
|
// TODO(bugs.webrtc.org/8878)
|
|
|
|
|
#if defined(WEBRTC_MAC)
|
|
|
|
|
#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
|
|
|
|
|
DISABLED_UpDownUpAudioVideoTransportSequenceNumberRtx
|
|
|
|
|
#else
|
|
|
|
|
#define MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx \
|
|
|
|
|
UpDownUpAudioVideoTransportSequenceNumberRtx
|
|
|
|
|
#endif
|
|
|
|
|
TEST_F(RampUpTest, MAYBE_UpDownUpAudioVideoTransportSequenceNumberRtx) {
|
2019-02-15 10:54:55 +01:00
|
|
|
test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates = {0, 0, 0, 0};
|
|
|
|
|
RampUpDownUpTester test(3, 1, 0, kStartBitrateBps,
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension::kTransportSequenceNumberUri, true,
|
2017-03-13 01:27:03 -07:00
|
|
|
false, loss_rates, false);
|
2016-01-14 10:00:21 +01:00
|
|
|
RunBaseTest(&test);
|
2016-07-26 04:44:06 -07:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, UpDownUpAudioTransportSequenceNumberRtx) {
|
2019-02-15 10:54:55 +01:00
|
|
|
test::ScopedFieldTrials field_trials("WebRTC-Audio-SendSideBwe/Enabled/");
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates = {0, 0, 0, 0};
|
|
|
|
|
RampUpDownUpTester test(0, 1, 0, kStartBitrateBps,
|
2016-07-26 04:44:06 -07:00
|
|
|
RtpExtension::kTransportSequenceNumberUri, true,
|
2017-03-13 01:27:03 -07:00
|
|
|
false, loss_rates, false);
|
2016-07-26 04:44:06 -07:00
|
|
|
RunBaseTest(&test);
|
2016-01-14 10:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, TOffsetSimulcastRedRtx) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTimestampOffsetUri, true,
|
|
|
|
|
true, true);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2014-12-10 10:36:20 +00:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, AbsSendTime) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, false, false,
|
2017-03-13 01:27:03 -07:00
|
|
|
false);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2015-04-21 20:24:50 +08:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, AbsSendTimeSimulcastRedRtx) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kAbsSendTimeUri, true, true,
|
2017-01-27 06:43:18 -08:00
|
|
|
true);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2014-12-10 10:36:20 +00:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, TransportSequenceNumber) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(1, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
|
2017-03-13 01:27:03 -07:00
|
|
|
false, false, false);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2015-09-24 15:06:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(RampUpTest, TransportSequenceNumberSimulcast) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
|
2017-03-13 01:27:03 -07:00
|
|
|
false, false, false);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2015-09-24 15:06:57 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-09 04:19:24 -08:00
|
|
|
TEST_F(RampUpTest, TransportSequenceNumberSimulcastRedRtx) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(3, 0, 0, 0, 0, RtpExtension::kTransportSequenceNumberUri,
|
2017-01-27 06:43:18 -08:00
|
|
|
true, true, true);
|
|
|
|
|
RunBaseTest(&test);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 10:23:13 +01:00
|
|
|
TEST_F(RampUpTest, AudioTransportSequenceNumber) {
|
2017-02-21 07:28:31 -08:00
|
|
|
RampUpTester test(0, 1, 0, 300000, 10000,
|
2017-01-27 06:43:18 -08:00
|
|
|
RtpExtension::kTransportSequenceNumberUri, false, false,
|
|
|
|
|
false);
|
2016-01-08 06:47:13 -08:00
|
|
|
RunBaseTest(&test);
|
2015-09-24 15:06:57 +02:00
|
|
|
}
|
2013-09-10 09:26:25 +00:00
|
|
|
} // namespace webrtc
|