2014-07-08 13:59:46 +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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef CALL_RAMPUP_TESTS_H_
|
|
|
|
|
#define CALL_RAMPUP_TESTS_H_
|
2014-07-08 13:59:46 +00:00
|
|
|
|
|
|
|
|
#include <map>
|
2019-09-30 04:16:28 +02:00
|
|
|
#include <memory>
|
2014-07-08 13:59:46 +00:00
|
|
|
#include <string>
|
2018-08-21 21:01:00 +02:00
|
|
|
#include <utility>
|
2014-07-08 13:59:46 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
2022-05-17 11:48:46 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
2019-08-07 12:24:53 +02:00
|
|
|
#include "api/rtc_event_log/rtc_event_log.h"
|
2019-09-30 04:16:28 +02:00
|
|
|
#include "api/task_queue/task_queue_base.h"
|
2022-09-26 13:21:14 +02:00
|
|
|
#include "api/test/metrics/metric.h"
|
2018-08-17 14:26:54 +02:00
|
|
|
#include "api/test/simulated_network.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/call.h"
|
2018-08-21 21:01:00 +02:00
|
|
|
#include "call/simulated_network.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/event.h"
|
2019-10-21 11:08:13 +02:00
|
|
|
#include "rtc_base/task_utils/repeating_task.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/call_test.h"
|
2014-07-08 13:59:46 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
static const int kTransmissionTimeOffsetExtensionId = 6;
|
|
|
|
|
static const int kAbsSendTimeExtensionId = 7;
|
2015-09-24 15:06:57 +02:00
|
|
|
static const int kTransportSequenceNumberExtensionId = 8;
|
2014-07-08 13:59:46 +00:00
|
|
|
static const unsigned int kSingleStreamTargetBps = 1000000;
|
|
|
|
|
|
|
|
|
|
class Clock;
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
class RampUpTester : public test::EndToEndTest {
|
2014-07-08 13:59:46 +00:00
|
|
|
public:
|
2015-12-21 03:14:00 -08:00
|
|
|
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
|
|
|
bool rtx,
|
2017-01-27 06:43:18 -08:00
|
|
|
bool red,
|
2019-08-05 15:29:14 +02:00
|
|
|
bool report_perf_stats,
|
2019-10-21 11:08:13 +02:00
|
|
|
TaskQueueBase* task_queue);
|
2015-09-28 03:57:14 -07:00
|
|
|
~RampUpTester() override;
|
2014-07-08 13:59:46 +00:00
|
|
|
|
2016-01-12 15:51:22 +01:00
|
|
|
size_t GetNumVideoStreams() const override;
|
2016-01-14 10:00:21 +01:00
|
|
|
size_t GetNumAudioStreams() const override;
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t GetNumFlexfecStreams() const override;
|
2016-01-12 15:51:22 +01:00
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
void PerformTest() override;
|
2014-07-08 13:59:46 +00:00
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
protected:
|
2017-02-22 11:22:05 -08:00
|
|
|
virtual void PollStats();
|
2015-07-06 10:50:47 +02:00
|
|
|
|
2015-09-29 02:26:42 -07:00
|
|
|
void 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-24 15:06:57 +02:00
|
|
|
|
2022-05-17 11:48:46 +02:00
|
|
|
void ReportResult(absl::string_view measurement,
|
2014-07-08 13:59:46 +00:00
|
|
|
size_t value,
|
2022-09-26 13:21:14 +02:00
|
|
|
test::Unit unit,
|
|
|
|
|
test::ImprovementDirection improvement_direction) const;
|
2015-09-28 03:57:14 -07:00
|
|
|
void TriggerTestDone();
|
2014-07-08 13:59:46 +00:00
|
|
|
|
|
|
|
|
Clock* const clock_;
|
2018-10-08 12:28:56 +02:00
|
|
|
BuiltInNetworkBehaviorConfig forward_transport_config_;
|
2015-12-21 03:14:00 -08:00
|
|
|
const size_t num_video_streams_;
|
|
|
|
|
const size_t num_audio_streams_;
|
2017-02-21 07:28:31 -08:00
|
|
|
const size_t num_flexfec_streams_;
|
2015-09-28 03:57:14 -07:00
|
|
|
const bool rtx_;
|
|
|
|
|
const bool red_;
|
2017-03-09 06:27:02 -08:00
|
|
|
const bool report_perf_stats_;
|
2016-07-26 04:44:06 -07:00
|
|
|
Call* sender_call_;
|
2015-09-28 03:57:14 -07:00
|
|
|
VideoSendStream* send_stream_;
|
2015-10-27 08:29:42 -07:00
|
|
|
test::PacketTransport* send_transport_;
|
2023-01-19 15:45:58 +00:00
|
|
|
SimulatedNetworkInterface* send_simulated_network_;
|
2014-07-08 13:59:46 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-09-28 03:57:14 -07:00
|
|
|
typedef std::map<uint32_t, uint32_t> SsrcMap;
|
2016-10-02 23:45:26 -07:00
|
|
|
class VideoStreamFactory;
|
2014-07-08 13:59:46 +00:00
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void ModifySenderBitrateConfig(BitrateConstraints* bitrate_config) override;
|
2022-05-20 15:21:20 +02:00
|
|
|
void OnVideoStreamsCreated(VideoSendStream* send_stream,
|
|
|
|
|
const std::vector<VideoReceiveStreamInterface*>&
|
|
|
|
|
receive_streams) override;
|
2023-01-19 15:45:58 +00:00
|
|
|
BuiltInNetworkBehaviorConfig GetSendTransportConfig() const override;
|
2015-12-21 03:14:00 -08:00
|
|
|
void ModifyVideoConfigs(
|
|
|
|
|
VideoSendStream::Config* send_config,
|
2022-05-20 15:21:20 +02:00
|
|
|
std::vector<VideoReceiveStreamInterface::Config>* receive_configs,
|
2015-12-21 03:14:00 -08:00
|
|
|
VideoEncoderConfig* encoder_config) override;
|
2022-05-22 20:47:28 +02:00
|
|
|
void ModifyAudioConfigs(AudioSendStream::Config* send_config,
|
|
|
|
|
std::vector<AudioReceiveStreamInterface::Config>*
|
|
|
|
|
receive_configs) override;
|
2017-02-21 07:28:31 -08:00
|
|
|
void ModifyFlexfecConfigs(
|
|
|
|
|
std::vector<FlexfecReceiveStream::Config>* receive_configs) override;
|
2015-09-28 03:57:14 -07:00
|
|
|
void OnCallsCreated(Call* sender_call, Call* receiver_call) override;
|
2023-01-19 15:45:58 +00:00
|
|
|
void OnTransportCreated(test::PacketTransport* to_receiver,
|
|
|
|
|
SimulatedNetworkInterface* sender_network,
|
|
|
|
|
test::PacketTransport* to_sender,
|
|
|
|
|
SimulatedNetworkInterface* receiver_network) override;
|
2015-09-28 03:57:14 -07:00
|
|
|
|
|
|
|
|
const int start_bitrate_bps_;
|
2017-01-27 06:43:18 -08:00
|
|
|
const int64_t min_run_time_ms_;
|
2015-09-28 03:57:14 -07:00
|
|
|
int expected_bitrate_bps_;
|
|
|
|
|
int64_t test_start_ms_;
|
|
|
|
|
int64_t ramp_up_finished_ms_;
|
|
|
|
|
|
2015-12-21 03:14:00 -08:00
|
|
|
std::vector<uint32_t> video_ssrcs_;
|
|
|
|
|
std::vector<uint32_t> video_rtx_ssrcs_;
|
|
|
|
|
std::vector<uint32_t> audio_ssrcs_;
|
2015-09-28 03:57:14 -07:00
|
|
|
|
2019-08-05 15:29:14 +02:00
|
|
|
protected:
|
2019-10-21 11:08:13 +02:00
|
|
|
TaskQueueBase* const task_queue_;
|
|
|
|
|
RepeatingTaskHandle pending_task_;
|
2014-07-08 13:59:46 +00:00
|
|
|
};
|
|
|
|
|
|
2015-09-28 03:57:14 -07:00
|
|
|
class RampUpDownUpTester : public RampUpTester {
|
|
|
|
|
public:
|
2019-10-21 11:08:13 +02:00
|
|
|
RampUpDownUpTester(size_t num_video_streams,
|
|
|
|
|
size_t num_audio_streams,
|
|
|
|
|
size_t num_flexfec_streams,
|
|
|
|
|
unsigned int start_bitrate_bps,
|
|
|
|
|
bool rtx,
|
|
|
|
|
bool red,
|
|
|
|
|
const std::vector<int>& loss_rates,
|
|
|
|
|
bool report_perf_stats,
|
|
|
|
|
TaskQueueBase* task_queue);
|
2015-09-28 03:57:14 -07:00
|
|
|
~RampUpDownUpTester() override;
|
|
|
|
|
|
|
|
|
|
protected:
|
2017-02-22 11:22:05 -08:00
|
|
|
void PollStats() override;
|
2015-09-28 03:57:14 -07:00
|
|
|
|
|
|
|
|
private:
|
2017-02-21 07:28:31 -08:00
|
|
|
enum TestStates {
|
|
|
|
|
kFirstRampup = 0,
|
|
|
|
|
kLowRate,
|
|
|
|
|
kSecondRampup,
|
|
|
|
|
kTestEnd,
|
|
|
|
|
kTransitionToNextState,
|
|
|
|
|
};
|
2015-09-28 03:57:14 -07:00
|
|
|
|
2018-11-13 15:10:33 +01:00
|
|
|
void ModifyReceiverBitrateConfig(BitrateConstraints* bitrate_config) override;
|
2015-09-28 03:57:14 -07:00
|
|
|
|
|
|
|
|
std::string GetModifierString() const;
|
2016-12-05 08:23:40 -08:00
|
|
|
int GetExpectedHighBitrate() const;
|
2017-01-09 04:19:24 -08:00
|
|
|
int GetHighLinkCapacity() const;
|
2017-02-21 07:28:31 -08:00
|
|
|
size_t GetFecBytes() const;
|
|
|
|
|
bool ExpectingFec() const;
|
2015-09-28 03:57:14 -07:00
|
|
|
void EvolveTestState(int bitrate_bps, bool suspended);
|
2014-07-08 13:59:46 +00:00
|
|
|
|
2017-02-21 07:28:31 -08:00
|
|
|
const std::vector<int> link_rates_;
|
2015-09-28 03:57:14 -07:00
|
|
|
TestStates test_state_;
|
2017-02-21 07:28:31 -08:00
|
|
|
TestStates next_state_;
|
2015-09-28 03:57:14 -07:00
|
|
|
int64_t state_start_ms_;
|
|
|
|
|
int64_t interval_start_ms_;
|
|
|
|
|
int sent_bytes_;
|
2017-02-21 07:28:31 -08:00
|
|
|
std::vector<int> loss_rates_;
|
2014-07-08 13:59:46 +00:00
|
|
|
};
|
2022-09-26 13:21:14 +02:00
|
|
|
|
2014-07-08 13:59:46 +00:00
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // CALL_RAMPUP_TESTS_H_
|