pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 10 | |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 11 | #include <algorithm> |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 12 | #include <limits> |
kwiberg | b25345e | 2016-03-12 06:10:44 -0800 | [diff] [blame] | 13 | #include <memory> |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 14 | #include <string> |
| 15 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 16 | #include "absl/memory/memory.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "api/audio_codecs/builtin_audio_encoder_factory.h" |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 18 | #include "api/test/simulated_network.h" |
Jiawei Ou | c2ebe21 | 2018-11-08 10:02:56 -0800 | [diff] [blame] | 19 | #include "api/video/builtin_video_bitrate_allocator_factory.h" |
Erik Språng | ef75ebe | 2018-05-15 15:18:36 +0200 | [diff] [blame] | 20 | #include "api/video/video_bitrate_allocation.h" |
Niels Möller | 0a8f435 | 2018-05-18 11:37:23 +0200 | [diff] [blame] | 21 | #include "api/video_codecs/video_encoder_config.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 22 | #include "call/call.h" |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 23 | #include "call/fake_network_pipe.h" |
| 24 | #include "call/simulated_network.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "logging/rtc_event_log/rtc_event_log.h" |
| 26 | #include "modules/audio_coding/include/audio_coding_module.h" |
Artem Titov | 3faa832 | 2018-03-07 14:44:00 +0100 | [diff] [blame] | 27 | #include "modules/audio_device/include/test_audio_device.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 28 | #include "modules/audio_mixer/audio_mixer_impl.h" |
| 29 | #include "modules/rtp_rtcp/include/rtp_header_parser.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 30 | #include "rtc_base/bitrate_allocation_strategy.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 31 | #include "rtc_base/checks.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 32 | #include "rtc_base/thread_annotations.h" |
Mirko Bonadei | 17f4878 | 2018-09-28 08:51:10 +0200 | [diff] [blame] | 33 | #include "system_wrappers/include/metrics.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 34 | #include "test/call_test.h" |
| 35 | #include "test/direct_transport.h" |
| 36 | #include "test/drifting_clock.h" |
| 37 | #include "test/encoder_settings.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 38 | #include "test/fake_encoder.h" |
| 39 | #include "test/field_trial.h" |
| 40 | #include "test/frame_generator.h" |
| 41 | #include "test/frame_generator_capturer.h" |
| 42 | #include "test/gtest.h" |
Niels Möller | ae4237e | 2018-10-05 11:28:38 +0200 | [diff] [blame] | 43 | #include "test/null_transport.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 44 | #include "test/rtp_rtcp_observer.h" |
| 45 | #include "test/single_threaded_task_queue.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 46 | #include "test/testsupport/file_utils.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 47 | #include "test/testsupport/perf_test.h" |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 48 | #include "test/video_encoder_proxy_factory.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 49 | #include "video/transport_adapter.h" |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 50 | |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 51 | using webrtc::test::DriftingClock; |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 52 | |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 53 | namespace webrtc { |
| 54 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 55 | class CallPerfTest : public test::CallTest { |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 56 | protected: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 57 | enum class FecMode { kOn, kOff }; |
| 58 | enum class CreateOrder { kAudioFirst, kVideoFirst }; |
Danil Chapovalov | cde5d6b | 2016-02-15 11:14:58 +0100 | [diff] [blame] | 59 | void TestAudioVideoSync(FecMode fec, |
| 60 | CreateOrder create_first, |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 61 | float video_ntp_speed, |
| 62 | float video_rtp_speed, |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 63 | float audio_rtp_speed, |
| 64 | const std::string& test_label); |
stefan@webrtc.org | 01581da | 2014-09-04 06:48:14 +0000 | [diff] [blame] | 65 | |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 66 | void TestMinTransmitBitrate(bool pad_to_min_bitrate); |
| 67 | |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 68 | void TestCaptureNtpTime(const BuiltInNetworkBehaviorConfig& net_config, |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 69 | int threshold_ms, |
| 70 | int start_time_ms, |
| 71 | int run_time_ms); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 72 | void TestMinAudioVideoBitrate(bool use_bitrate_allocation_strategy, |
| 73 | int test_bitrate_from, |
| 74 | int test_bitrate_to, |
| 75 | int test_bitrate_step, |
| 76 | int min_bwe, |
| 77 | int start_bwe, |
| 78 | int max_bwe); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 79 | }; |
| 80 | |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 81 | class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver, |
nisse | 7ade7b3 | 2016-03-23 04:48:10 -0700 | [diff] [blame] | 82 | public rtc::VideoSinkInterface<VideoFrame> { |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 83 | static const int kInSyncThresholdMs = 50; |
| 84 | static const int kStartupTimeMs = 2000; |
| 85 | static const int kMinRunTimeMs = 30000; |
| 86 | |
| 87 | public: |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 88 | explicit VideoRtcpAndSyncObserver(Clock* clock, const std::string& test_label) |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 89 | : test::RtpRtcpObserver(CallPerfTest::kLongTimeoutMs), |
| 90 | clock_(clock), |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 91 | test_label_(test_label), |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 92 | creation_time_ms_(clock_->TimeInMilliseconds()), |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 93 | first_time_in_sync_(-1), |
| 94 | receive_stream_(nullptr) {} |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 95 | |
nisse | eb83a1a | 2016-03-21 01:27:56 -0700 | [diff] [blame] | 96 | void OnFrame(const VideoFrame& video_frame) override { |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 97 | VideoReceiveStream::Stats stats; |
| 98 | { |
| 99 | rtc::CritScope lock(&crit_); |
| 100 | if (receive_stream_) |
| 101 | stats = receive_stream_->GetStats(); |
| 102 | } |
| 103 | if (stats.sync_offset_ms == std::numeric_limits<int>::max()) |
| 104 | return; |
| 105 | |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 106 | int64_t now_ms = clock_->TimeInMilliseconds(); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 107 | int64_t time_since_creation = now_ms - creation_time_ms_; |
| 108 | // During the first couple of seconds audio and video can falsely be |
| 109 | // estimated as being synchronized. We don't want to trigger on those. |
| 110 | if (time_since_creation < kStartupTimeMs) |
| 111 | return; |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 112 | if (std::abs(stats.sync_offset_ms) < kInSyncThresholdMs) { |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 113 | if (first_time_in_sync_ == -1) { |
| 114 | first_time_in_sync_ = now_ms; |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 115 | webrtc::test::PrintResult("sync_convergence_time", test_label_, |
| 116 | "synchronization", time_since_creation, "ms", |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 117 | false); |
| 118 | } |
| 119 | if (time_since_creation > kMinRunTimeMs) |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 120 | observation_complete_.Set(); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 121 | } |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 122 | if (first_time_in_sync_ != -1) |
| 123 | sync_offset_ms_list_.push_back(stats.sync_offset_ms); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 124 | } |
| 125 | |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 126 | void set_receive_stream(VideoReceiveStream* receive_stream) { |
| 127 | rtc::CritScope lock(&crit_); |
| 128 | receive_stream_ = receive_stream; |
| 129 | } |
| 130 | |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 131 | void PrintResults() { |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 132 | test::PrintResultList("stream_offset", test_label_, "synchronization", |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 133 | sync_offset_ms_list_, "ms", false); |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 134 | } |
| 135 | |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 136 | private: |
pbos@webrtc.org | de1429e | 2014-04-28 13:00:21 +0000 | [diff] [blame] | 137 | Clock* const clock_; |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 138 | std::string test_label_; |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 139 | const int64_t creation_time_ms_; |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 140 | int64_t first_time_in_sync_; |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 141 | rtc::CriticalSection crit_; |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 142 | VideoReceiveStream* receive_stream_ RTC_GUARDED_BY(crit_); |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 143 | std::vector<double> sync_offset_ms_list_; |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 144 | }; |
| 145 | |
Danil Chapovalov | cde5d6b | 2016-02-15 11:14:58 +0100 | [diff] [blame] | 146 | void CallPerfTest::TestAudioVideoSync(FecMode fec, |
| 147 | CreateOrder create_first, |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 148 | float video_ntp_speed, |
| 149 | float video_rtp_speed, |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 150 | float audio_rtp_speed, |
| 151 | const std::string& test_label) { |
pbos | 8fc7fa7 | 2015-07-15 08:02:58 -0700 | [diff] [blame] | 152 | const char* kSyncGroup = "av_sync"; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 153 | const uint32_t kAudioSendSsrc = 1234; |
| 154 | const uint32_t kAudioRecvSsrc = 5678; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 155 | |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 156 | BuiltInNetworkBehaviorConfig audio_net_config; |
mflodman | 3d7db26 | 2016-04-29 00:57:13 -0700 | [diff] [blame] | 157 | audio_net_config.queue_delay_ms = 500; |
| 158 | audio_net_config.loss_percent = 5; |
minyue | 20c84cc | 2017-04-10 16:57:57 -0700 | [diff] [blame] | 159 | |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 160 | VideoRtcpAndSyncObserver observer(Clock::GetRealTimeClock(), test_label); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 161 | |
minyue | 20c84cc | 2017-04-10 16:57:57 -0700 | [diff] [blame] | 162 | std::map<uint8_t, MediaType> audio_pt_map; |
| 163 | std::map<uint8_t, MediaType> video_pt_map; |
minyue | 20c84cc | 2017-04-10 16:57:57 -0700 | [diff] [blame] | 164 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 165 | std::unique_ptr<test::PacketTransport> audio_send_transport; |
| 166 | std::unique_ptr<test::PacketTransport> video_send_transport; |
| 167 | std::unique_ptr<test::PacketTransport> receive_transport; |
Niels Möller | ae4237e | 2018-10-05 11:28:38 +0200 | [diff] [blame] | 168 | test::NullTransport rtcp_send_transport; |
mflodman | 3d7db26 | 2016-04-29 00:57:13 -0700 | [diff] [blame] | 169 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 170 | AudioSendStream* audio_send_stream; |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 171 | AudioReceiveStream* audio_receive_stream; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 172 | std::unique_ptr<DriftingClock> drifting_clock; |
pbos | 8fc7fa7 | 2015-07-15 08:02:58 -0700 | [diff] [blame] | 173 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 174 | task_queue_.SendTask([&]() { |
| 175 | metrics::Reset(); |
Artem Titov | 3faa832 | 2018-03-07 14:44:00 +0100 | [diff] [blame] | 176 | rtc::scoped_refptr<TestAudioDeviceModule> fake_audio_device = |
| 177 | TestAudioDeviceModule::CreateTestAudioDeviceModule( |
| 178 | TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000), |
| 179 | TestAudioDeviceModule::CreateDiscardRenderer(48000), |
| 180 | audio_rtp_speed); |
Fredrik Solenberg | d319534 | 2017-11-21 20:33:05 +0100 | [diff] [blame] | 181 | EXPECT_EQ(0, fake_audio_device->Init()); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 182 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 183 | AudioState::Config send_audio_state_config; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 184 | send_audio_state_config.audio_mixer = AudioMixerImpl::Create(); |
Ivo Creusen | 62337e5 | 2018-01-09 14:17:33 +0100 | [diff] [blame] | 185 | send_audio_state_config.audio_processing = |
| 186 | AudioProcessingBuilder().Create(); |
Fredrik Solenberg | 2a87797 | 2017-12-15 16:42:15 +0100 | [diff] [blame] | 187 | send_audio_state_config.audio_device_module = fake_audio_device; |
Sebastian Jansson | 8e6602f | 2018-07-13 10:43:20 +0200 | [diff] [blame] | 188 | Call::Config sender_config(send_event_log_.get()); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 189 | |
Fredrik Solenberg | d319534 | 2017-11-21 20:33:05 +0100 | [diff] [blame] | 190 | auto audio_state = AudioState::Create(send_audio_state_config); |
| 191 | fake_audio_device->RegisterAudioCallback(audio_state->audio_transport()); |
| 192 | sender_config.audio_state = audio_state; |
Sebastian Jansson | 8e6602f | 2018-07-13 10:43:20 +0200 | [diff] [blame] | 193 | Call::Config receiver_config(recv_event_log_.get()); |
Fredrik Solenberg | d319534 | 2017-11-21 20:33:05 +0100 | [diff] [blame] | 194 | receiver_config.audio_state = audio_state; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 195 | CreateCalls(sender_config, receiver_config); |
| 196 | |
| 197 | std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_), |
| 198 | std::inserter(audio_pt_map, audio_pt_map.end()), |
| 199 | [](const std::pair<const uint8_t, MediaType>& pair) { |
| 200 | return pair.second == MediaType::AUDIO; |
| 201 | }); |
| 202 | std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_), |
| 203 | std::inserter(video_pt_map, video_pt_map.end()), |
| 204 | [](const std::pair<const uint8_t, MediaType>& pair) { |
| 205 | return pair.second == MediaType::VIDEO; |
| 206 | }); |
| 207 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 208 | audio_send_transport = absl::make_unique<test::PacketTransport>( |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 209 | &task_queue_, sender_call_.get(), &observer, |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 210 | test::PacketTransport::kSender, audio_pt_map, |
| 211 | absl::make_unique<FakeNetworkPipe>( |
| 212 | Clock::GetRealTimeClock(), |
| 213 | absl::make_unique<SimulatedNetwork>(audio_net_config))); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 214 | audio_send_transport->SetReceiver(receiver_call_->Receiver()); |
| 215 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 216 | video_send_transport = absl::make_unique<test::PacketTransport>( |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 217 | &task_queue_, sender_call_.get(), &observer, |
| 218 | test::PacketTransport::kSender, video_pt_map, |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 219 | absl::make_unique<FakeNetworkPipe>( |
| 220 | Clock::GetRealTimeClock(), absl::make_unique<SimulatedNetwork>( |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 221 | BuiltInNetworkBehaviorConfig()))); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 222 | video_send_transport->SetReceiver(receiver_call_->Receiver()); |
| 223 | |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 224 | receive_transport = absl::make_unique<test::PacketTransport>( |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 225 | &task_queue_, receiver_call_.get(), &observer, |
| 226 | test::PacketTransport::kReceiver, payload_type_map_, |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 227 | absl::make_unique<FakeNetworkPipe>( |
| 228 | Clock::GetRealTimeClock(), absl::make_unique<SimulatedNetwork>( |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 229 | BuiltInNetworkBehaviorConfig()))); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 230 | receive_transport->SetReceiver(sender_call_->Receiver()); |
| 231 | |
| 232 | CreateSendConfig(1, 0, 0, video_send_transport.get()); |
| 233 | CreateMatchingReceiveConfigs(receive_transport.get()); |
| 234 | |
Niels Möller | 7d76a31 | 2018-10-26 12:57:07 +0200 | [diff] [blame] | 235 | AudioSendStream::Config audio_send_config(audio_send_transport.get(), |
| 236 | /*media_transport=*/nullptr); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 237 | audio_send_config.rtp.ssrc = kAudioSendSsrc; |
Oskar Sundbom | fedc00c | 2017-11-16 10:55:08 +0100 | [diff] [blame] | 238 | audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec( |
| 239 | kAudioSendPayloadType, {"ISAC", 16000, 1}); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 240 | audio_send_config.encoder_factory = CreateBuiltinAudioEncoderFactory(); |
| 241 | audio_send_stream = sender_call_->CreateAudioSendStream(audio_send_config); |
| 242 | |
Sebastian Jansson | f33905d | 2018-07-13 09:49:00 +0200 | [diff] [blame] | 243 | GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 244 | if (fec == FecMode::kOn) { |
Sebastian Jansson | f33905d | 2018-07-13 09:49:00 +0200 | [diff] [blame] | 245 | GetVideoSendConfig()->rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 246 | GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
nisse | 3b3622f | 2017-09-26 02:49:21 -0700 | [diff] [blame] | 247 | video_receive_configs_[0].rtp.red_payload_type = kRedPayloadType; |
| 248 | video_receive_configs_[0].rtp.ulpfec_payload_type = kUlpfecPayloadType; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 249 | } |
| 250 | video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000; |
| 251 | video_receive_configs_[0].renderer = &observer; |
| 252 | video_receive_configs_[0].sync_group = kSyncGroup; |
| 253 | |
| 254 | AudioReceiveStream::Config audio_recv_config; |
| 255 | audio_recv_config.rtp.remote_ssrc = kAudioSendSsrc; |
| 256 | audio_recv_config.rtp.local_ssrc = kAudioRecvSsrc; |
Niels Möller | ae4237e | 2018-10-05 11:28:38 +0200 | [diff] [blame] | 257 | audio_recv_config.rtcp_send_transport = &rtcp_send_transport; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 258 | audio_recv_config.sync_group = kSyncGroup; |
Niels Möller | 2784a03 | 2018-03-28 14:16:04 +0200 | [diff] [blame] | 259 | audio_recv_config.decoder_factory = audio_decoder_factory_; |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 260 | audio_recv_config.decoder_map = { |
| 261 | {kAudioSendPayloadType, {"ISAC", 16000, 1}}}; |
| 262 | |
| 263 | if (create_first == CreateOrder::kAudioFirst) { |
| 264 | audio_receive_stream = |
| 265 | receiver_call_->CreateAudioReceiveStream(audio_recv_config); |
| 266 | CreateVideoStreams(); |
| 267 | } else { |
| 268 | CreateVideoStreams(); |
| 269 | audio_receive_stream = |
| 270 | receiver_call_->CreateAudioReceiveStream(audio_recv_config); |
| 271 | } |
| 272 | EXPECT_EQ(1u, video_receive_streams_.size()); |
| 273 | observer.set_receive_stream(video_receive_streams_[0]); |
Karl Wiberg | 918f50c | 2018-07-05 11:40:33 +0200 | [diff] [blame] | 274 | drifting_clock = absl::make_unique<DriftingClock>(clock_, video_ntp_speed); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 275 | CreateFrameGeneratorCapturerWithDrift(drifting_clock.get(), video_rtp_speed, |
| 276 | kDefaultFramerate, kDefaultWidth, |
| 277 | kDefaultHeight); |
| 278 | |
| 279 | Start(); |
| 280 | |
| 281 | audio_send_stream->Start(); |
| 282 | audio_receive_stream->Start(); |
| 283 | }); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 284 | |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 285 | EXPECT_TRUE(observer.Wait()) |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 286 | << "Timed out while waiting for audio and video to be synchronized."; |
| 287 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 288 | task_queue_.SendTask([&]() { |
| 289 | audio_send_stream->Stop(); |
| 290 | audio_receive_stream->Stop(); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 291 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 292 | Stop(); |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 293 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 294 | DestroyStreams(); |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 295 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 296 | video_send_transport.reset(); |
| 297 | audio_send_transport.reset(); |
| 298 | receive_transport.reset(); |
Stefan Holmer | b86d4e4 | 2015-12-07 10:26:18 +0100 | [diff] [blame] | 299 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 300 | sender_call_->DestroyAudioSendStream(audio_send_stream); |
| 301 | receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 302 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 303 | DestroyCalls(); |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 304 | }); |
asapersson | f8cdd18 | 2016-03-15 01:00:47 -0700 | [diff] [blame] | 305 | |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 306 | observer.PrintResults(); |
ilnik | 5328b9e | 2017-02-21 05:20:28 -0800 | [diff] [blame] | 307 | |
| 308 | // In quick test synchronization may not be achieved in time. |
sprang | e5d3a3e | 2017-03-01 06:20:56 -0800 | [diff] [blame] | 309 | if (!field_trial::IsEnabled("WebRTC-QuickPerfTest")) { |
ilnik | 5328b9e | 2017-02-21 05:20:28 -0800 | [diff] [blame] | 310 | EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs")); |
| 311 | } |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 312 | } |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 313 | |
Niels Möller | 9a75061 | 2018-08-09 11:04:32 +0200 | [diff] [blame] | 314 | TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithoutClockDrift) { |
| 315 | TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |
| 316 | DriftingClock::kNoDrift, DriftingClock::kNoDrift, |
| 317 | DriftingClock::kNoDrift, "_video_no_drift"); |
| 318 | } |
| 319 | |
danilchap | ac287ee | 2016-02-29 12:17:04 -0800 | [diff] [blame] | 320 | TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { |
Danil Chapovalov | cde5d6b | 2016-02-15 11:14:58 +0100 | [diff] [blame] | 321 | TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |
| 322 | DriftingClock::PercentsFaster(10.0f), |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 323 | DriftingClock::kNoDrift, DriftingClock::kNoDrift, |
| 324 | "_video_ntp_drift"); |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 325 | } |
| 326 | |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 327 | TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) { |
Danil Chapovalov | cde5d6b | 2016-02-15 11:14:58 +0100 | [diff] [blame] | 328 | TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |
| 329 | DriftingClock::kNoDrift, |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 330 | DriftingClock::PercentsSlower(30.0f), |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 331 | DriftingClock::PercentsFaster(30.0f), "_audio_faster"); |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoFasterThanAudioDrift) { |
Danil Chapovalov | cde5d6b | 2016-02-15 11:14:58 +0100 | [diff] [blame] | 335 | TestAudioVideoSync(FecMode::kOn, CreateOrder::kVideoFirst, |
| 336 | DriftingClock::kNoDrift, |
danilchap | 9c6a0c7 | 2016-02-10 10:54:47 -0800 | [diff] [blame] | 337 | DriftingClock::PercentsFaster(30.0f), |
Edward Lemur | 947f3fe | 2017-12-28 15:50:33 +0100 | [diff] [blame] | 338 | DriftingClock::PercentsSlower(30.0f), "_video_faster"); |
stefan@webrtc.org | 01581da | 2014-09-04 06:48:14 +0000 | [diff] [blame] | 339 | } |
| 340 | |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 341 | void CallPerfTest::TestCaptureNtpTime( |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 342 | const BuiltInNetworkBehaviorConfig& net_config, |
Artem Titov | 46c4e60 | 2018-08-17 14:26:54 +0200 | [diff] [blame] | 343 | int threshold_ms, |
| 344 | int start_time_ms, |
| 345 | int run_time_ms) { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 346 | class CaptureNtpTimeObserver : public test::EndToEndTest, |
nisse | 7ade7b3 | 2016-03-23 04:48:10 -0700 | [diff] [blame] | 347 | public rtc::VideoSinkInterface<VideoFrame> { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 348 | public: |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 349 | CaptureNtpTimeObserver(const BuiltInNetworkBehaviorConfig& net_config, |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 350 | int threshold_ms, |
| 351 | int start_time_ms, |
| 352 | int run_time_ms) |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 353 | : EndToEndTest(kLongTimeoutMs), |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 354 | net_config_(net_config), |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 355 | clock_(Clock::GetRealTimeClock()), |
| 356 | threshold_ms_(threshold_ms), |
| 357 | start_time_ms_(start_time_ms), |
| 358 | run_time_ms_(run_time_ms), |
| 359 | creation_time_ms_(clock_->TimeInMilliseconds()), |
pbos@webrtc.org | 2b4ce3a | 2015-03-23 13:12:24 +0000 | [diff] [blame] | 360 | capturer_(nullptr), |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 361 | rtp_start_timestamp_set_(false), |
| 362 | rtp_start_timestamp_(0) {} |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 363 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 364 | private: |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 365 | test::PacketTransport* CreateSendTransport( |
| 366 | test::SingleThreadedTaskQueueForTesting* task_queue, |
| 367 | Call* sender_call) override { |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 368 | return new test::PacketTransport( |
| 369 | task_queue, sender_call, this, test::PacketTransport::kSender, |
| 370 | payload_type_map_, |
| 371 | absl::make_unique<FakeNetworkPipe>( |
| 372 | Clock::GetRealTimeClock(), |
| 373 | absl::make_unique<SimulatedNetwork>(net_config_))); |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 374 | } |
| 375 | |
eladalon | 413ee9a | 2017-08-22 04:02:52 -0700 | [diff] [blame] | 376 | test::PacketTransport* CreateReceiveTransport( |
| 377 | test::SingleThreadedTaskQueueForTesting* task_queue) override { |
Artem Titov | 4e199e9 | 2018-08-20 13:30:39 +0200 | [diff] [blame] | 378 | return new test::PacketTransport( |
| 379 | task_queue, nullptr, this, test::PacketTransport::kReceiver, |
| 380 | payload_type_map_, |
| 381 | absl::make_unique<FakeNetworkPipe>( |
| 382 | Clock::GetRealTimeClock(), |
| 383 | absl::make_unique<SimulatedNetwork>(net_config_))); |
Stefan Holmer | ea8c0f6 | 2016-01-13 08:58:38 +0100 | [diff] [blame] | 384 | } |
| 385 | |
nisse | eb83a1a | 2016-03-21 01:27:56 -0700 | [diff] [blame] | 386 | void OnFrame(const VideoFrame& video_frame) override { |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 387 | rtc::CritScope lock(&crit_); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 388 | if (video_frame.ntp_time_ms() <= 0) { |
| 389 | // Haven't got enough RTCP SR in order to calculate the capture ntp |
| 390 | // time. |
| 391 | return; |
| 392 | } |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 393 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 394 | int64_t now_ms = clock_->TimeInMilliseconds(); |
| 395 | int64_t time_since_creation = now_ms - creation_time_ms_; |
| 396 | if (time_since_creation < start_time_ms_) { |
| 397 | // Wait for |start_time_ms_| before start measuring. |
| 398 | return; |
| 399 | } |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 400 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 401 | if (time_since_creation > run_time_ms_) { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 402 | observation_complete_.Set(); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 403 | } |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 404 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 405 | FrameCaptureTimeList::iterator iter = |
| 406 | capture_time_list_.find(video_frame.timestamp()); |
| 407 | EXPECT_TRUE(iter != capture_time_list_.end()); |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 408 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 409 | // The real capture time has been wrapped to uint32_t before converted |
| 410 | // to rtp timestamp in the sender side. So here we convert the estimated |
| 411 | // capture time to a uint32_t 90k timestamp also for comparing. |
| 412 | uint32_t estimated_capture_timestamp = |
| 413 | 90 * static_cast<uint32_t>(video_frame.ntp_time_ms()); |
| 414 | uint32_t real_capture_timestamp = iter->second; |
| 415 | int time_offset_ms = real_capture_timestamp - estimated_capture_timestamp; |
| 416 | time_offset_ms = time_offset_ms / 90; |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 417 | time_offset_ms_list_.push_back(time_offset_ms); |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 418 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 419 | EXPECT_TRUE(std::abs(time_offset_ms) < threshold_ms_); |
| 420 | } |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 421 | |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 422 | Action OnSendRtp(const uint8_t* packet, size_t length) override { |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 423 | rtc::CritScope lock(&crit_); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 424 | RTPHeader header; |
pbos@webrtc.org | 62bafae | 2014-07-08 12:10:51 +0000 | [diff] [blame] | 425 | EXPECT_TRUE(parser_->Parse(packet, length, &header)); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 426 | |
| 427 | if (!rtp_start_timestamp_set_) { |
| 428 | // Calculate the rtp timestamp offset in order to calculate the real |
| 429 | // capture time. |
| 430 | uint32_t first_capture_timestamp = |
| 431 | 90 * static_cast<uint32_t>(capturer_->first_frame_capture_time()); |
| 432 | rtp_start_timestamp_ = header.timestamp - first_capture_timestamp; |
| 433 | rtp_start_timestamp_set_ = true; |
| 434 | } |
| 435 | |
| 436 | uint32_t capture_timestamp = header.timestamp - rtp_start_timestamp_; |
| 437 | capture_time_list_.insert( |
| 438 | capture_time_list_.end(), |
| 439 | std::make_pair(header.timestamp, capture_timestamp)); |
| 440 | return SEND_PACKET; |
| 441 | } |
| 442 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 443 | void OnFrameGeneratorCapturerCreated( |
| 444 | test::FrameGeneratorCapturer* frame_generator_capturer) override { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 445 | capturer_ = frame_generator_capturer; |
| 446 | } |
| 447 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 448 | void ModifyVideoConfigs( |
| 449 | VideoSendStream::Config* send_config, |
| 450 | std::vector<VideoReceiveStream::Config>* receive_configs, |
| 451 | VideoEncoderConfig* encoder_config) override { |
pbos@webrtc.org | be9d2a4 | 2014-06-30 13:19:09 +0000 | [diff] [blame] | 452 | (*receive_configs)[0].renderer = this; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 453 | // Enable the receiver side rtt calculation. |
pbos@webrtc.org | be9d2a4 | 2014-06-30 13:19:09 +0000 | [diff] [blame] | 454 | (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = true; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 455 | } |
| 456 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 457 | void PerformTest() override { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 458 | EXPECT_TRUE(Wait()) << "Timed out while waiting for " |
| 459 | "estimated capture NTP time to be " |
| 460 | "within bounds."; |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 461 | test::PrintResultList("capture_ntp_time", "", "real - estimated", |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 462 | time_offset_ms_list_, "ms", true); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 463 | } |
| 464 | |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 465 | rtc::CriticalSection crit_; |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 466 | const BuiltInNetworkBehaviorConfig net_config_; |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 467 | Clock* const clock_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 468 | int threshold_ms_; |
| 469 | int start_time_ms_; |
| 470 | int run_time_ms_; |
| 471 | int64_t creation_time_ms_; |
| 472 | test::FrameGeneratorCapturer* capturer_; |
| 473 | bool rtp_start_timestamp_set_; |
| 474 | uint32_t rtp_start_timestamp_; |
| 475 | typedef std::map<uint32_t, uint32_t> FrameCaptureTimeList; |
danilchap | a37de39 | 2017-09-09 04:17:22 -0700 | [diff] [blame] | 476 | FrameCaptureTimeList capture_time_list_ RTC_GUARDED_BY(&crit_); |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 477 | std::vector<double> time_offset_ms_list_; |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 478 | } test(net_config, threshold_ms, start_time_ms, run_time_ms); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 479 | |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 480 | RunBaseTest(&test); |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 481 | } |
| 482 | |
Alex Loiko | af228ee | 2018-11-22 11:53:18 +0100 | [diff] [blame] | 483 | // Flaky tests, disabled on Mac and Windows due to webrtc:8291. |
| 484 | #if !(defined(WEBRTC_MAC) || defined(WEBRTC_WIN)) |
wu@webrtc.org | 9aa7d8d | 2014-05-29 05:03:52 +0000 | [diff] [blame] | 485 | TEST_F(CallPerfTest, CaptureNtpTimeWithNetworkDelay) { |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 486 | BuiltInNetworkBehaviorConfig net_config; |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 487 | net_config.queue_delay_ms = 100; |
| 488 | // TODO(wu): lower the threshold as the calculation/estimatation becomes more |
| 489 | // accurate. |
wu@webrtc.org | 9aa7d8d | 2014-05-29 05:03:52 +0000 | [diff] [blame] | 490 | const int kThresholdMs = 100; |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 491 | const int kStartTimeMs = 10000; |
| 492 | const int kRunTimeMs = 20000; |
| 493 | TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs); |
| 494 | } |
| 495 | |
wu@webrtc.org | 0224c20 | 2014-05-05 17:42:43 +0000 | [diff] [blame] | 496 | TEST_F(CallPerfTest, CaptureNtpTimeWithNetworkJitter) { |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 497 | BuiltInNetworkBehaviorConfig net_config; |
wu@webrtc.org | 0224c20 | 2014-05-05 17:42:43 +0000 | [diff] [blame] | 498 | net_config.queue_delay_ms = 100; |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 499 | net_config.delay_standard_deviation_ms = 10; |
| 500 | // TODO(wu): lower the threshold as the calculation/estimatation becomes more |
| 501 | // accurate. |
wu@webrtc.org | 0224c20 | 2014-05-05 17:42:43 +0000 | [diff] [blame] | 502 | const int kThresholdMs = 100; |
wu@webrtc.org | cd70119 | 2014-04-24 22:10:24 +0000 | [diff] [blame] | 503 | const int kStartTimeMs = 10000; |
| 504 | const int kRunTimeMs = 20000; |
| 505 | TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs); |
| 506 | } |
Alex Loiko | 5aea38c | 2017-09-27 13:10:28 +0200 | [diff] [blame] | 507 | #endif |
kthelgason | fa5fdce | 2017-02-27 00:15:31 -0800 | [diff] [blame] | 508 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 509 | TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) { |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 510 | // Minimal normal usage at the start, then 30s overuse to allow filter to |
| 511 | // settle, and then 80s underuse to allow plenty of time for rampup again. |
| 512 | test::ScopedFieldTrials fake_overuse_settings( |
| 513 | "WebRTC-ForceSimulatedOveruseIntervalMs/1-30000-80000/"); |
| 514 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 515 | class LoadObserver : public test::SendTest, |
| 516 | public test::FrameGeneratorCapturer::SinkWantsObserver { |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 517 | public: |
Åsa Persson | 8c1bf95 | 2018-09-13 10:42:19 +0200 | [diff] [blame] | 518 | LoadObserver() : SendTest(kLongTimeoutMs), test_phase_(TestPhase::kInit) {} |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 519 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 520 | void OnFrameGeneratorCapturerCreated( |
| 521 | test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 522 | frame_generator_capturer->SetSinkWantsObserver(this); |
kthelgason | fa5fdce | 2017-02-27 00:15:31 -0800 | [diff] [blame] | 523 | // Set a high initial resolution to be sure that we can scale down. |
| 524 | frame_generator_capturer->ChangeResolution(1920, 1080); |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink |
| 528 | // is called. |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 529 | // TODO(sprang): Add integration test for maintain-framerate mode? |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 530 | void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 531 | const rtc::VideoSinkWants& wants) override { |
Åsa Persson | 8c1bf95 | 2018-09-13 10:42:19 +0200 | [diff] [blame] | 532 | // At kStart expect CPU overuse. Then expect CPU underuse when the encoder |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 533 | // delay has been decreased. |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 534 | switch (test_phase_) { |
Åsa Persson | 8c1bf95 | 2018-09-13 10:42:19 +0200 | [diff] [blame] | 535 | case TestPhase::kInit: |
| 536 | // Max framerate should be set initially. |
| 537 | if (wants.max_framerate_fps != std::numeric_limits<int>::max() && |
| 538 | wants.max_pixel_count == std::numeric_limits<int>::max()) { |
| 539 | test_phase_ = TestPhase::kStart; |
| 540 | } else { |
| 541 | ADD_FAILURE() << "Got unexpected adaptation request, max res = " |
| 542 | << wants.max_pixel_count << ", target res = " |
| 543 | << wants.target_pixel_count.value_or(-1) |
| 544 | << ", max fps = " << wants.max_framerate_fps; |
| 545 | } |
| 546 | break; |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 547 | case TestPhase::kStart: |
| 548 | if (wants.max_pixel_count < std::numeric_limits<int>::max()) { |
mflodman | cc3d442 | 2017-08-03 08:27:51 -0700 | [diff] [blame] | 549 | // On adapting down, VideoStreamEncoder::VideoSourceProxy will set |
| 550 | // only the max pixel count, leaving the target unset. |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 551 | test_phase_ = TestPhase::kAdaptedDown; |
| 552 | } else { |
| 553 | ADD_FAILURE() << "Got unexpected adaptation request, max res = " |
| 554 | << wants.max_pixel_count << ", target res = " |
| 555 | << wants.target_pixel_count.value_or(-1) |
| 556 | << ", max fps = " << wants.max_framerate_fps; |
| 557 | } |
| 558 | break; |
| 559 | case TestPhase::kAdaptedDown: |
| 560 | // On adapting up, the adaptation counter will again be at zero, and |
| 561 | // so all constraints will be reset. |
| 562 | if (wants.max_pixel_count == std::numeric_limits<int>::max() && |
| 563 | !wants.target_pixel_count) { |
| 564 | test_phase_ = TestPhase::kAdaptedUp; |
| 565 | observation_complete_.Set(); |
| 566 | } else { |
| 567 | ADD_FAILURE() << "Got unexpected adaptation request, max res = " |
| 568 | << wants.max_pixel_count << ", target res = " |
| 569 | << wants.target_pixel_count.value_or(-1) |
| 570 | << ", max fps = " << wants.max_framerate_fps; |
| 571 | } |
| 572 | break; |
| 573 | case TestPhase::kAdaptedUp: |
| 574 | ADD_FAILURE() << "Got unexpected adaptation request, max res = " |
| 575 | << wants.max_pixel_count << ", target res = " |
| 576 | << wants.target_pixel_count.value_or(-1) |
| 577 | << ", max fps = " << wants.max_framerate_fps; |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 578 | } |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 579 | } |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 580 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 581 | void ModifyVideoConfigs( |
| 582 | VideoSendStream::Config* send_config, |
| 583 | std::vector<VideoReceiveStream::Config>* receive_configs, |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 584 | VideoEncoderConfig* encoder_config) override {} |
asapersson@webrtc.org | 049e4ec | 2014-11-20 10:19:46 +0000 | [diff] [blame] | 585 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 586 | void PerformTest() override { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 587 | EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback."; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 588 | } |
asapersson@webrtc.org | 049e4ec | 2014-11-20 10:19:46 +0000 | [diff] [blame] | 589 | |
Åsa Persson | 8c1bf95 | 2018-09-13 10:42:19 +0200 | [diff] [blame] | 590 | enum class TestPhase { |
| 591 | kInit, |
| 592 | kStart, |
| 593 | kAdaptedDown, |
| 594 | kAdaptedUp |
| 595 | } test_phase_; |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 596 | } test; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 597 | |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 598 | RunBaseTest(&test); |
asapersson@webrtc.org | bdc5ed2 | 2014-01-31 10:05:07 +0000 | [diff] [blame] | 599 | } |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 600 | |
| 601 | void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) { |
| 602 | static const int kMaxEncodeBitrateKbps = 30; |
pbos@webrtc.org | 709e297 | 2014-03-19 10:59:52 +0000 | [diff] [blame] | 603 | static const int kMinTransmitBitrateBps = 150000; |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 604 | static const int kMinAcceptableTransmitBitrate = 130; |
| 605 | static const int kMaxAcceptableTransmitBitrate = 170; |
| 606 | static const int kNumBitrateObservationsInRange = 100; |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 607 | static const int kAcceptableBitrateErrorMargin = 15; // +- 7 |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 608 | class BitrateObserver : public test::EndToEndTest { |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 609 | public: |
| 610 | explicit BitrateObserver(bool using_min_transmit_bitrate) |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 611 | : EndToEndTest(kLongTimeoutMs), |
pbos@webrtc.org | 2b4ce3a | 2015-03-23 13:12:24 +0000 | [diff] [blame] | 612 | send_stream_(nullptr), |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 613 | converged_(false), |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 614 | pad_to_min_bitrate_(using_min_transmit_bitrate), |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 615 | min_acceptable_bitrate_(using_min_transmit_bitrate |
| 616 | ? kMinAcceptableTransmitBitrate |
| 617 | : (kMaxEncodeBitrateKbps - |
| 618 | kAcceptableBitrateErrorMargin / 2)), |
| 619 | max_acceptable_bitrate_(using_min_transmit_bitrate |
| 620 | ? kMaxAcceptableTransmitBitrate |
| 621 | : (kMaxEncodeBitrateKbps + |
| 622 | kAcceptableBitrateErrorMargin / 2)), |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 623 | num_bitrate_observations_in_range_(0) {} |
| 624 | |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 625 | private: |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 626 | // TODO(holmer): Run this with a timer instead of once per packet. |
| 627 | Action OnSendRtp(const uint8_t* packet, size_t length) override { |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 628 | VideoSendStream::Stats stats = send_stream_->GetStats(); |
| 629 | if (stats.substreams.size() > 0) { |
kwiberg | af476c7 | 2016-11-28 15:21:39 -0800 | [diff] [blame] | 630 | RTC_DCHECK_EQ(1, stats.substreams.size()); |
stefan@webrtc.org | 0bae1fa | 2014-11-05 14:05:29 +0000 | [diff] [blame] | 631 | int bitrate_kbps = |
| 632 | stats.substreams.begin()->second.total_bitrate_bps / 1000; |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 633 | if (bitrate_kbps > min_acceptable_bitrate_ && |
| 634 | bitrate_kbps < max_acceptable_bitrate_) { |
| 635 | converged_ = true; |
| 636 | ++num_bitrate_observations_in_range_; |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 637 | if (num_bitrate_observations_in_range_ == |
| 638 | kNumBitrateObservationsInRange) |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 639 | observation_complete_.Set(); |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 640 | } |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 641 | if (converged_) |
| 642 | bitrate_kbps_list_.push_back(bitrate_kbps); |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 643 | } |
stefan | f116bd0 | 2015-10-27 08:29:42 -0700 | [diff] [blame] | 644 | return SEND_PACKET; |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 645 | } |
| 646 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 647 | void OnVideoStreamsCreated( |
pbos@webrtc.org | be9d2a4 | 2014-06-30 13:19:09 +0000 | [diff] [blame] | 648 | VideoSendStream* send_stream, |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 649 | const std::vector<VideoReceiveStream*>& receive_streams) override { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 650 | send_stream_ = send_stream; |
| 651 | } |
| 652 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 653 | void ModifyVideoConfigs( |
| 654 | VideoSendStream::Config* send_config, |
| 655 | std::vector<VideoReceiveStream::Config>* receive_configs, |
| 656 | VideoEncoderConfig* encoder_config) override { |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 657 | if (pad_to_min_bitrate_) { |
pbos@webrtc.org | ad3b5a5 | 2014-10-24 09:23:21 +0000 | [diff] [blame] | 658 | encoder_config->min_transmit_bitrate_bps = kMinTransmitBitrateBps; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 659 | } else { |
henrikg | 91d6ede | 2015-09-17 00:24:34 -0700 | [diff] [blame] | 660 | RTC_DCHECK_EQ(0, encoder_config->min_transmit_bitrate_bps); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 661 | } |
| 662 | } |
| 663 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 664 | void PerformTest() override { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 665 | EXPECT_TRUE(Wait()) << "Timeout while waiting for send-bitrate stats."; |
danilchap | 46b89b9 | 2016-06-03 09:27:37 -0700 | [diff] [blame] | 666 | test::PrintResultList( |
| 667 | "bitrate_stats_", |
| 668 | (pad_to_min_bitrate_ ? "min_transmit_bitrate" |
| 669 | : "without_min_transmit_bitrate"), |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 670 | "bitrate_kbps", bitrate_kbps_list_, "kbps", false); |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 671 | } |
| 672 | |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 673 | VideoSendStream* send_stream_; |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 674 | bool converged_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 675 | const bool pad_to_min_bitrate_; |
Danil Chapovalov | 371b43b | 2016-06-16 09:58:44 +0200 | [diff] [blame] | 676 | const int min_acceptable_bitrate_; |
| 677 | const int max_acceptable_bitrate_; |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 678 | int num_bitrate_observations_in_range_; |
Edward Lemur | 2f06168 | 2017-11-24 13:40:01 +0100 | [diff] [blame] | 679 | std::vector<double> bitrate_kbps_list_; |
pbos@webrtc.org | 994d0b7 | 2014-06-27 08:47:52 +0000 | [diff] [blame] | 680 | } test(pad_to_min_bitrate); |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 681 | |
Niels Möller | 4db138e | 2018-04-19 09:04:13 +0200 | [diff] [blame] | 682 | fake_encoder_max_bitrate_ = kMaxEncodeBitrateKbps; |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 683 | RunBaseTest(&test); |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 684 | } |
| 685 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 686 | TEST_F(CallPerfTest, PadsToMinTransmitBitrate) { |
| 687 | TestMinTransmitBitrate(true); |
| 688 | } |
pbos@webrtc.org | 3349ae0 | 2014-03-13 12:52:27 +0000 | [diff] [blame] | 689 | |
| 690 | TEST_F(CallPerfTest, NoPadWithoutMinTransmitBitrate) { |
| 691 | TestMinTransmitBitrate(false); |
| 692 | } |
| 693 | |
Taylor Brandstetter | 85904f4 | 2018-02-16 10:11:49 -0800 | [diff] [blame] | 694 | // TODO(bugs.webrtc.org/8878) |
| 695 | #if defined(WEBRTC_MAC) |
| 696 | #define MAYBE_KeepsHighBitrateWhenReconfiguringSender \ |
| 697 | DISABLED_KeepsHighBitrateWhenReconfiguringSender |
| 698 | #else |
| 699 | #define MAYBE_KeepsHighBitrateWhenReconfiguringSender \ |
| 700 | KeepsHighBitrateWhenReconfiguringSender |
| 701 | #endif |
| 702 | TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) { |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 703 | static const uint32_t kInitialBitrateKbps = 400; |
| 704 | static const uint32_t kReconfigureThresholdKbps = 600; |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 705 | |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 706 | class VideoStreamFactory |
| 707 | : public VideoEncoderConfig::VideoStreamFactoryInterface { |
| 708 | public: |
| 709 | VideoStreamFactory() {} |
| 710 | |
| 711 | private: |
| 712 | std::vector<VideoStream> CreateEncoderStreams( |
| 713 | int width, |
| 714 | int height, |
| 715 | const VideoEncoderConfig& encoder_config) override { |
| 716 | std::vector<VideoStream> streams = |
| 717 | test::CreateVideoStreams(width, height, encoder_config); |
| 718 | streams[0].min_bitrate_bps = 50000; |
| 719 | streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000; |
| 720 | return streams; |
| 721 | } |
| 722 | }; |
| 723 | |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 724 | class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder { |
| 725 | public: |
| 726 | BitrateObserver() |
| 727 | : EndToEndTest(kDefaultTimeoutMs), |
| 728 | FakeEncoder(Clock::GetRealTimeClock()), |
sprang | 867fb52 | 2015-08-03 04:38:41 -0700 | [diff] [blame] | 729 | encoder_inits_(0), |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 730 | last_set_bitrate_kbps_(0), |
| 731 | send_stream_(nullptr), |
Niels Möller | 4db138e | 2018-04-19 09:04:13 +0200 | [diff] [blame] | 732 | frame_generator_(nullptr), |
Jiawei Ou | c2ebe21 | 2018-11-08 10:02:56 -0800 | [diff] [blame] | 733 | encoder_factory_(this), |
| 734 | bitrate_allocator_factory_( |
| 735 | CreateBuiltinVideoBitrateAllocatorFactory()) {} |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 736 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 737 | int32_t InitEncode(const VideoCodec* config, |
| 738 | int32_t number_of_cores, |
| 739 | size_t max_payload_size) override { |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 740 | ++encoder_inits_; |
| 741 | if (encoder_inits_ == 1) { |
emircan | 05a55b5 | 2016-10-28 14:06:29 -0700 | [diff] [blame] | 742 | // First time initialization. Frame size is known. |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 743 | // |expected_bitrate| is affected by bandwidth estimation before the |
| 744 | // first frame arrives to the encoder. |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 745 | uint32_t expected_bitrate = last_set_bitrate_kbps_ > 0 |
| 746 | ? last_set_bitrate_kbps_ |
| 747 | : kInitialBitrateKbps; |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 748 | EXPECT_EQ(expected_bitrate, config->startBitrate) |
| 749 | << "Encoder not initialized at expected bitrate."; |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 750 | EXPECT_EQ(kDefaultWidth, config->width); |
| 751 | EXPECT_EQ(kDefaultHeight, config->height); |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 752 | } else if (encoder_inits_ == 2) { |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 753 | EXPECT_EQ(2 * kDefaultWidth, config->width); |
| 754 | EXPECT_EQ(2 * kDefaultHeight, config->height); |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 755 | EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps); |
philipel | 0676f22 | 2018-04-17 16:12:21 +0200 | [diff] [blame] | 756 | EXPECT_GT(config->startBitrate, kReconfigureThresholdKbps) |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 757 | << "Encoder reconfigured with bitrate too far away from last set."; |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 758 | observation_complete_.Set(); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 759 | } |
| 760 | return FakeEncoder::InitEncode(config, number_of_cores, max_payload_size); |
| 761 | } |
| 762 | |
Erik Språng | 566124a | 2018-04-23 12:32:22 +0200 | [diff] [blame] | 763 | int32_t SetRateAllocation(const VideoBitrateAllocation& rate_allocation, |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 764 | uint32_t framerate) override { |
| 765 | last_set_bitrate_kbps_ = rate_allocation.get_sum_kbps(); |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 766 | if (encoder_inits_ == 1 && |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 767 | rate_allocation.get_sum_kbps() > kReconfigureThresholdKbps) { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 768 | time_to_reconfigure_.Set(); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 769 | } |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 770 | return FakeEncoder::SetRateAllocation(rate_allocation, framerate); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 771 | } |
| 772 | |
Niels Möller | de8e6e6 | 2018-11-13 15:10:33 +0100 | [diff] [blame] | 773 | void ModifySenderBitrateConfig( |
| 774 | BitrateConstraints* bitrate_config) override { |
| 775 | bitrate_config->start_bitrate_bps = kInitialBitrateKbps * 1000; |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 776 | } |
| 777 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 778 | void ModifyVideoConfigs( |
| 779 | VideoSendStream::Config* send_config, |
| 780 | std::vector<VideoReceiveStream::Config>* receive_configs, |
| 781 | VideoEncoderConfig* encoder_config) override { |
Niels Möller | 4db138e | 2018-04-19 09:04:13 +0200 | [diff] [blame] | 782 | send_config->encoder_settings.encoder_factory = &encoder_factory_; |
Jiawei Ou | c2ebe21 | 2018-11-08 10:02:56 -0800 | [diff] [blame] | 783 | send_config->encoder_settings.bitrate_allocator_factory = |
| 784 | bitrate_allocator_factory_.get(); |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 785 | encoder_config->max_bitrate_bps = 2 * kReconfigureThresholdKbps * 1000; |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 786 | encoder_config->video_stream_factory = |
| 787 | new rtc::RefCountedObject<VideoStreamFactory>(); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 788 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 789 | encoder_config_ = encoder_config->Copy(); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 790 | } |
| 791 | |
stefan | ff48361 | 2015-12-21 03:14:00 -0800 | [diff] [blame] | 792 | void OnVideoStreamsCreated( |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 793 | VideoSendStream* send_stream, |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 794 | const std::vector<VideoReceiveStream*>& receive_streams) override { |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 795 | send_stream_ = send_stream; |
| 796 | } |
| 797 | |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 798 | void OnFrameGeneratorCapturerCreated( |
| 799 | test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 800 | frame_generator_ = frame_generator_capturer; |
| 801 | } |
| 802 | |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 803 | void PerformTest() override { |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 804 | ASSERT_TRUE(time_to_reconfigure_.Wait(kDefaultTimeoutMs)) |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 805 | << "Timed out before receiving an initial high bitrate."; |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 806 | frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 807 | send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy()); |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 808 | EXPECT_TRUE(Wait()) |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 809 | << "Timed out while waiting for a couple of high bitrate estimates " |
| 810 | "after reconfiguring the send stream."; |
| 811 | } |
| 812 | |
| 813 | private: |
Peter Boström | 5811a39 | 2015-12-10 13:02:50 +0100 | [diff] [blame] | 814 | rtc::Event time_to_reconfigure_; |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 815 | int encoder_inits_; |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 816 | uint32_t last_set_bitrate_kbps_; |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 817 | VideoSendStream* send_stream_; |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 818 | test::FrameGeneratorCapturer* frame_generator_; |
Niels Möller | cbcbc22 | 2018-09-28 09:07:24 +0200 | [diff] [blame] | 819 | test::VideoEncoderProxyFactory encoder_factory_; |
Jiawei Ou | c2ebe21 | 2018-11-08 10:02:56 -0800 | [diff] [blame] | 820 | std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_; |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 821 | VideoEncoderConfig encoder_config_; |
| 822 | } test; |
| 823 | |
stefan | e74eef1 | 2016-01-08 06:47:13 -0800 | [diff] [blame] | 824 | RunBaseTest(&test); |
pbos@webrtc.org | 32452b2 | 2014-10-22 12:15:24 +0000 | [diff] [blame] | 825 | } |
| 826 | |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 827 | // Discovers the minimal supported audio+video bitrate. The test bitrate is |
| 828 | // considered supported if Rtt does not go above 400ms with the network |
| 829 | // contrained to the test bitrate. |
| 830 | // |
| 831 | // |use_bitrate_allocation_strategy| use AudioPriorityBitrateAllocationStrategy |
| 832 | // |test_bitrate_from test_bitrate_to| bitrate constraint range |
| 833 | // |test_bitrate_step| bitrate constraint update step during the test |
| 834 | // |min_bwe max_bwe| BWE range |
| 835 | // |start_bwe| initial BWE |
| 836 | void CallPerfTest::TestMinAudioVideoBitrate( |
| 837 | bool use_bitrate_allocation_strategy, |
| 838 | int test_bitrate_from, |
| 839 | int test_bitrate_to, |
| 840 | int test_bitrate_step, |
| 841 | int min_bwe, |
| 842 | int start_bwe, |
| 843 | int max_bwe) { |
| 844 | static const std::string kAudioTrackId = "audio_track_0"; |
| 845 | static constexpr uint32_t kSufficientAudioBitrateBps = 16000; |
| 846 | static constexpr int kOpusMinBitrateBps = 6000; |
| 847 | static constexpr int kOpusBitrateFbBps = 32000; |
| 848 | static constexpr int kBitrateStabilizationMs = 10000; |
| 849 | static constexpr int kBitrateMeasurements = 10; |
| 850 | static constexpr int kBitrateMeasurementMs = 1000; |
| 851 | static constexpr int kMinGoodRttMs = 400; |
| 852 | |
| 853 | class MinVideoAndAudioBitrateTester : public test::EndToEndTest { |
| 854 | public: |
| 855 | MinVideoAndAudioBitrateTester(bool use_bitrate_allocation_strategy, |
| 856 | int test_bitrate_from, |
| 857 | int test_bitrate_to, |
| 858 | int test_bitrate_step, |
| 859 | int min_bwe, |
| 860 | int start_bwe, |
| 861 | int max_bwe) |
| 862 | : EndToEndTest(), |
| 863 | allocation_strategy_(new rtc::AudioPriorityBitrateAllocationStrategy( |
| 864 | kAudioTrackId, |
| 865 | kSufficientAudioBitrateBps)), |
| 866 | use_bitrate_allocation_strategy_(use_bitrate_allocation_strategy), |
| 867 | test_bitrate_from_(test_bitrate_from), |
| 868 | test_bitrate_to_(test_bitrate_to), |
| 869 | test_bitrate_step_(test_bitrate_step), |
| 870 | min_bwe_(min_bwe), |
| 871 | start_bwe_(start_bwe), |
| 872 | max_bwe_(max_bwe) {} |
| 873 | |
| 874 | protected: |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 875 | BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() { |
| 876 | BuiltInNetworkBehaviorConfig pipe_config; |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 877 | pipe_config.link_capacity_kbps = test_bitrate_from_; |
| 878 | return pipe_config; |
| 879 | } |
| 880 | |
| 881 | test::PacketTransport* CreateSendTransport( |
| 882 | test::SingleThreadedTaskQueueForTesting* task_queue, |
| 883 | Call* sender_call) override { |
Artem Titov | 631cafa | 2018-08-21 21:01:00 +0200 | [diff] [blame] | 884 | auto network = |
| 885 | absl::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig()); |
| 886 | send_simulated_network_ = network.get(); |
| 887 | return new test::PacketTransport( |
| 888 | task_queue, sender_call, this, test::PacketTransport::kSender, |
| 889 | test::CallTest::payload_type_map_, |
| 890 | absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(), |
| 891 | std::move(network))); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 892 | } |
| 893 | |
| 894 | test::PacketTransport* CreateReceiveTransport( |
| 895 | test::SingleThreadedTaskQueueForTesting* task_queue) override { |
Artem Titov | 631cafa | 2018-08-21 21:01:00 +0200 | [diff] [blame] | 896 | auto network = |
| 897 | absl::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig()); |
| 898 | receive_simulated_network_ = network.get(); |
| 899 | return new test::PacketTransport( |
| 900 | task_queue, nullptr, this, test::PacketTransport::kReceiver, |
| 901 | test::CallTest::payload_type_map_, |
| 902 | absl::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(), |
| 903 | std::move(network))); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | void PerformTest() override { |
| 907 | int last_passed_test_bitrate = -1; |
| 908 | for (int test_bitrate = test_bitrate_from_; |
| 909 | test_bitrate_from_ < test_bitrate_to_ |
| 910 | ? test_bitrate <= test_bitrate_to_ |
| 911 | : test_bitrate >= test_bitrate_to_; |
| 912 | test_bitrate += test_bitrate_step_) { |
Artem Titov | 75e3647 | 2018-10-08 12:28:56 +0200 | [diff] [blame] | 913 | BuiltInNetworkBehaviorConfig pipe_config; |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 914 | pipe_config.link_capacity_kbps = test_bitrate; |
Artem Titov | 631cafa | 2018-08-21 21:01:00 +0200 | [diff] [blame] | 915 | send_simulated_network_->SetConfig(pipe_config); |
| 916 | receive_simulated_network_->SetConfig(pipe_config); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 917 | |
| 918 | rtc::ThreadManager::Instance()->CurrentThread()->SleepMs( |
| 919 | kBitrateStabilizationMs); |
| 920 | |
| 921 | int64_t avg_rtt = 0; |
| 922 | for (int i = 0; i < kBitrateMeasurements; i++) { |
| 923 | Call::Stats call_stats = sender_call_->GetStats(); |
| 924 | avg_rtt += call_stats.rtt_ms; |
| 925 | rtc::ThreadManager::Instance()->CurrentThread()->SleepMs( |
| 926 | kBitrateMeasurementMs); |
| 927 | } |
| 928 | avg_rtt = avg_rtt / kBitrateMeasurements; |
| 929 | if (avg_rtt > kMinGoodRttMs) { |
| 930 | break; |
| 931 | } else { |
| 932 | last_passed_test_bitrate = test_bitrate; |
| 933 | } |
| 934 | } |
| 935 | EXPECT_GT(last_passed_test_bitrate, -1) |
| 936 | << "Minimum supported bitrate out of the test scope"; |
Edward Lemur | 7f331fa | 2018-01-08 17:35:51 +0100 | [diff] [blame] | 937 | webrtc::test::PrintResult( |
| 938 | "min_test_bitrate_", |
| 939 | use_bitrate_allocation_strategy_ ? "with_allocation_strategy" |
| 940 | : "no_allocation_strategy", |
| 941 | "min_bitrate", last_passed_test_bitrate, "kbps", false); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
| 945 | sender_call_ = sender_call; |
Sebastian Jansson | fc8d26b | 2018-02-21 09:52:06 +0100 | [diff] [blame] | 946 | BitrateConstraints bitrate_config; |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 947 | bitrate_config.min_bitrate_bps = min_bwe_; |
| 948 | bitrate_config.start_bitrate_bps = start_bwe_; |
| 949 | bitrate_config.max_bitrate_bps = max_bwe_; |
Sebastian Jansson | 8f83b42 | 2018-02-21 13:07:13 +0100 | [diff] [blame] | 950 | sender_call->GetTransportControllerSend()->SetSdpBitrateParameters( |
| 951 | bitrate_config); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 952 | if (use_bitrate_allocation_strategy_) { |
| 953 | sender_call->SetBitrateAllocationStrategy( |
| 954 | std::move(allocation_strategy_)); |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | size_t GetNumVideoStreams() const override { return 1; } |
| 959 | |
| 960 | size_t GetNumAudioStreams() const override { return 1; } |
| 961 | |
| 962 | void ModifyAudioConfigs( |
| 963 | AudioSendStream::Config* send_config, |
| 964 | std::vector<AudioReceiveStream::Config>* receive_configs) override { |
| 965 | if (use_bitrate_allocation_strategy_) { |
| 966 | send_config->track_id = kAudioTrackId; |
| 967 | send_config->min_bitrate_bps = kOpusMinBitrateBps; |
| 968 | send_config->max_bitrate_bps = kOpusBitrateFbBps; |
| 969 | } else { |
| 970 | send_config->send_codec_spec->target_bitrate_bps = |
Danil Chapovalov | b9b146c | 2018-06-15 12:28:07 +0200 | [diff] [blame] | 971 | absl::optional<int>(kOpusBitrateFbBps); |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 972 | } |
| 973 | } |
| 974 | |
| 975 | private: |
| 976 | std::unique_ptr<rtc::BitrateAllocationStrategy> allocation_strategy_; |
| 977 | const bool use_bitrate_allocation_strategy_; |
| 978 | const int test_bitrate_from_; |
| 979 | const int test_bitrate_to_; |
| 980 | const int test_bitrate_step_; |
| 981 | const int min_bwe_; |
| 982 | const int start_bwe_; |
| 983 | const int max_bwe_; |
Artem Titov | 631cafa | 2018-08-21 21:01:00 +0200 | [diff] [blame] | 984 | SimulatedNetwork* send_simulated_network_; |
| 985 | SimulatedNetwork* receive_simulated_network_; |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 986 | Call* sender_call_; |
| 987 | } test(use_bitrate_allocation_strategy, test_bitrate_from, test_bitrate_to, |
| 988 | test_bitrate_step, min_bwe, start_bwe, max_bwe); |
| 989 | |
| 990 | RunBaseTest(&test); |
| 991 | } |
| 992 | |
Taylor Brandstetter | 85904f4 | 2018-02-16 10:11:49 -0800 | [diff] [blame] | 993 | // TODO(bugs.webrtc.org/8878) |
| 994 | #if defined(WEBRTC_MAC) |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 995 | #define MAYBE_MinVideoAndAudioBitrate DISABLED_MinVideoAndAudioBitrate |
Taylor Brandstetter | 85904f4 | 2018-02-16 10:11:49 -0800 | [diff] [blame] | 996 | #else |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 997 | #define MAYBE_MinVideoAndAudioBitrate MinVideoAndAudioBitrate |
Taylor Brandstetter | 85904f4 | 2018-02-16 10:11:49 -0800 | [diff] [blame] | 998 | #endif |
| 999 | TEST_F(CallPerfTest, MAYBE_MinVideoAndAudioBitrate) { |
Alex Narest | d0e196b | 2017-11-22 17:22:35 +0100 | [diff] [blame] | 1000 | TestMinAudioVideoBitrate(false, 110, 40, -10, 10000, 70000, 200000); |
| 1001 | } |
| 1002 | TEST_F(CallPerfTest, MinVideoAndAudioBitrateWStrategy) { |
| 1003 | TestMinAudioVideoBitrate(true, 110, 40, -10, 10000, 70000, 200000); |
| 1004 | } |
| 1005 | |
pbos@webrtc.org | 1d09690 | 2013-12-13 12:48:05 +0000 | [diff] [blame] | 1006 | } // namespace webrtc |