You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1002 lines
39 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. */
  10. #include <algorithm>
  11. #include <limits>
  12. #include <memory>
  13. #include <string>
  14. #include "api/audio_codecs/builtin_audio_encoder_factory.h"
  15. #include "api/rtc_event_log/rtc_event_log.h"
  16. #include "api/task_queue/task_queue_base.h"
  17. #include "api/test/simulated_network.h"
  18. #include "api/video/builtin_video_bitrate_allocator_factory.h"
  19. #include "api/video/video_bitrate_allocation.h"
  20. #include "api/video_codecs/video_encoder.h"
  21. #include "api/video_codecs/video_encoder_config.h"
  22. #include "call/call.h"
  23. #include "call/fake_network_pipe.h"
  24. #include "call/simulated_network.h"
  25. #include "modules/audio_coding/include/audio_coding_module.h"
  26. #include "modules/audio_device/include/test_audio_device.h"
  27. #include "modules/audio_mixer/audio_mixer_impl.h"
  28. #include "rtc_base/checks.h"
  29. #include "rtc_base/task_queue_for_test.h"
  30. #include "rtc_base/thread.h"
  31. #include "rtc_base/thread_annotations.h"
  32. #include "system_wrappers/include/metrics.h"
  33. #include "test/call_test.h"
  34. #include "test/direct_transport.h"
  35. #include "test/drifting_clock.h"
  36. #include "test/encoder_settings.h"
  37. #include "test/fake_encoder.h"
  38. #include "test/field_trial.h"
  39. #include "test/frame_generator.h"
  40. #include "test/frame_generator_capturer.h"
  41. #include "test/gtest.h"
  42. #include "test/null_transport.h"
  43. #include "test/rtp_header_parser.h"
  44. #include "test/rtp_rtcp_observer.h"
  45. #include "test/testsupport/file_utils.h"
  46. #include "test/testsupport/perf_test.h"
  47. #include "test/video_encoder_proxy_factory.h"
  48. #include "video/transport_adapter.h"
  49. using webrtc::test::DriftingClock;
  50. namespace webrtc {
  51. namespace {
  52. enum : int { // The first valid value is 1.
  53. kTransportSequenceNumberExtensionId = 1,
  54. };
  55. } // namespace
  56. class CallPerfTest : public test::CallTest {
  57. public:
  58. CallPerfTest() {
  59. RegisterRtpExtension(RtpExtension(RtpExtension::kTransportSequenceNumberUri,
  60. kTransportSequenceNumberExtensionId));
  61. }
  62. protected:
  63. enum class FecMode { kOn, kOff };
  64. enum class CreateOrder { kAudioFirst, kVideoFirst };
  65. void TestAudioVideoSync(FecMode fec,
  66. CreateOrder create_first,
  67. float video_ntp_speed,
  68. float video_rtp_speed,
  69. float audio_rtp_speed,
  70. const std::string& test_label);
  71. void TestMinTransmitBitrate(bool pad_to_min_bitrate);
  72. void TestCaptureNtpTime(const BuiltInNetworkBehaviorConfig& net_config,
  73. int threshold_ms,
  74. int start_time_ms,
  75. int run_time_ms);
  76. void TestMinAudioVideoBitrate(int test_bitrate_from,
  77. int test_bitrate_to,
  78. int test_bitrate_step,
  79. int min_bwe,
  80. int start_bwe,
  81. int max_bwe);
  82. };
  83. class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver,
  84. public rtc::VideoSinkInterface<VideoFrame> {
  85. static const int kInSyncThresholdMs = 50;
  86. static const int kStartupTimeMs = 2000;
  87. static const int kMinRunTimeMs = 30000;
  88. public:
  89. explicit VideoRtcpAndSyncObserver(Clock* clock, const std::string& test_label)
  90. : test::RtpRtcpObserver(CallPerfTest::kLongTimeoutMs),
  91. clock_(clock),
  92. test_label_(test_label),
  93. creation_time_ms_(clock_->TimeInMilliseconds()),
  94. first_time_in_sync_(-1),
  95. receive_stream_(nullptr) {}
  96. void OnFrame(const VideoFrame& video_frame) override {
  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. int64_t now_ms = clock_->TimeInMilliseconds();
  106. int64_t time_since_creation = now_ms - creation_time_ms_;
  107. // During the first couple of seconds audio and video can falsely be
  108. // estimated as being synchronized. We don't want to trigger on those.
  109. if (time_since_creation < kStartupTimeMs)
  110. return;
  111. if (std::abs(stats.sync_offset_ms) < kInSyncThresholdMs) {
  112. if (first_time_in_sync_ == -1) {
  113. first_time_in_sync_ = now_ms;
  114. webrtc::test::PrintResult("sync_convergence_time", test_label_,
  115. "synchronization", time_since_creation, "ms",
  116. false);
  117. }
  118. if (time_since_creation > kMinRunTimeMs)
  119. observation_complete_.Set();
  120. }
  121. if (first_time_in_sync_ != -1)
  122. sync_offset_ms_list_.push_back(stats.sync_offset_ms);
  123. }
  124. void set_receive_stream(VideoReceiveStream* receive_stream) {
  125. rtc::CritScope lock(&crit_);
  126. receive_stream_ = receive_stream;
  127. }
  128. void PrintResults() {
  129. test::PrintResultList("stream_offset", test_label_, "synchronization",
  130. sync_offset_ms_list_, "ms", false);
  131. }
  132. private:
  133. Clock* const clock_;
  134. std::string test_label_;
  135. const int64_t creation_time_ms_;
  136. int64_t first_time_in_sync_;
  137. rtc::CriticalSection crit_;
  138. VideoReceiveStream* receive_stream_ RTC_GUARDED_BY(crit_);
  139. std::vector<double> sync_offset_ms_list_;
  140. };
  141. void CallPerfTest::TestAudioVideoSync(FecMode fec,
  142. CreateOrder create_first,
  143. float video_ntp_speed,
  144. float video_rtp_speed,
  145. float audio_rtp_speed,
  146. const std::string& test_label) {
  147. const char* kSyncGroup = "av_sync";
  148. const uint32_t kAudioSendSsrc = 1234;
  149. const uint32_t kAudioRecvSsrc = 5678;
  150. BuiltInNetworkBehaviorConfig audio_net_config;
  151. audio_net_config.queue_delay_ms = 500;
  152. audio_net_config.loss_percent = 5;
  153. VideoRtcpAndSyncObserver observer(Clock::GetRealTimeClock(), test_label);
  154. std::map<uint8_t, MediaType> audio_pt_map;
  155. std::map<uint8_t, MediaType> video_pt_map;
  156. std::unique_ptr<test::PacketTransport> audio_send_transport;
  157. std::unique_ptr<test::PacketTransport> video_send_transport;
  158. std::unique_ptr<test::PacketTransport> receive_transport;
  159. test::NullTransport rtcp_send_transport;
  160. AudioSendStream* audio_send_stream;
  161. AudioReceiveStream* audio_receive_stream;
  162. std::unique_ptr<DriftingClock> drifting_clock;
  163. SendTask(RTC_FROM_HERE, task_queue(), [&]() {
  164. metrics::Reset();
  165. rtc::scoped_refptr<TestAudioDeviceModule> fake_audio_device =
  166. TestAudioDeviceModule::Create(
  167. task_queue_factory_.get(),
  168. TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000),
  169. TestAudioDeviceModule::CreateDiscardRenderer(48000),
  170. audio_rtp_speed);
  171. EXPECT_EQ(0, fake_audio_device->Init());
  172. AudioState::Config send_audio_state_config;
  173. send_audio_state_config.audio_mixer = AudioMixerImpl::Create();
  174. send_audio_state_config.audio_processing =
  175. AudioProcessingBuilder().Create();
  176. send_audio_state_config.audio_device_module = fake_audio_device;
  177. Call::Config sender_config(send_event_log_.get());
  178. auto audio_state = AudioState::Create(send_audio_state_config);
  179. fake_audio_device->RegisterAudioCallback(audio_state->audio_transport());
  180. sender_config.audio_state = audio_state;
  181. Call::Config receiver_config(recv_event_log_.get());
  182. receiver_config.audio_state = audio_state;
  183. CreateCalls(sender_config, receiver_config);
  184. std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_),
  185. std::inserter(audio_pt_map, audio_pt_map.end()),
  186. [](const std::pair<const uint8_t, MediaType>& pair) {
  187. return pair.second == MediaType::AUDIO;
  188. });
  189. std::copy_if(std::begin(payload_type_map_), std::end(payload_type_map_),
  190. std::inserter(video_pt_map, video_pt_map.end()),
  191. [](const std::pair<const uint8_t, MediaType>& pair) {
  192. return pair.second == MediaType::VIDEO;
  193. });
  194. audio_send_transport = std::make_unique<test::PacketTransport>(
  195. task_queue(), sender_call_.get(), &observer,
  196. test::PacketTransport::kSender, audio_pt_map,
  197. std::make_unique<FakeNetworkPipe>(
  198. Clock::GetRealTimeClock(),
  199. std::make_unique<SimulatedNetwork>(audio_net_config)));
  200. audio_send_transport->SetReceiver(receiver_call_->Receiver());
  201. video_send_transport = std::make_unique<test::PacketTransport>(
  202. task_queue(), sender_call_.get(), &observer,
  203. test::PacketTransport::kSender, video_pt_map,
  204. std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
  205. std::make_unique<SimulatedNetwork>(
  206. BuiltInNetworkBehaviorConfig())));
  207. video_send_transport->SetReceiver(receiver_call_->Receiver());
  208. receive_transport = std::make_unique<test::PacketTransport>(
  209. task_queue(), receiver_call_.get(), &observer,
  210. test::PacketTransport::kReceiver, payload_type_map_,
  211. std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
  212. std::make_unique<SimulatedNetwork>(
  213. BuiltInNetworkBehaviorConfig())));
  214. receive_transport->SetReceiver(sender_call_->Receiver());
  215. CreateSendConfig(1, 0, 0, video_send_transport.get());
  216. CreateMatchingReceiveConfigs(receive_transport.get());
  217. AudioSendStream::Config audio_send_config(audio_send_transport.get(),
  218. MediaTransportConfig());
  219. audio_send_config.rtp.ssrc = kAudioSendSsrc;
  220. audio_send_config.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
  221. kAudioSendPayloadType, {"ISAC", 16000, 1});
  222. audio_send_config.encoder_factory = CreateBuiltinAudioEncoderFactory();
  223. audio_send_stream = sender_call_->CreateAudioSendStream(audio_send_config);
  224. GetVideoSendConfig()->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
  225. if (fec == FecMode::kOn) {
  226. GetVideoSendConfig()->rtp.ulpfec.red_payload_type = kRedPayloadType;
  227. GetVideoSendConfig()->rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
  228. video_receive_configs_[0].rtp.red_payload_type = kRedPayloadType;
  229. video_receive_configs_[0].rtp.ulpfec_payload_type = kUlpfecPayloadType;
  230. }
  231. video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000;
  232. video_receive_configs_[0].renderer = &observer;
  233. video_receive_configs_[0].sync_group = kSyncGroup;
  234. AudioReceiveStream::Config audio_recv_config;
  235. audio_recv_config.rtp.remote_ssrc = kAudioSendSsrc;
  236. audio_recv_config.rtp.local_ssrc = kAudioRecvSsrc;
  237. audio_recv_config.rtcp_send_transport = &rtcp_send_transport;
  238. audio_recv_config.sync_group = kSyncGroup;
  239. audio_recv_config.decoder_factory = audio_decoder_factory_;
  240. audio_recv_config.decoder_map = {
  241. {kAudioSendPayloadType, {"ISAC", 16000, 1}}};
  242. if (create_first == CreateOrder::kAudioFirst) {
  243. audio_receive_stream =
  244. receiver_call_->CreateAudioReceiveStream(audio_recv_config);
  245. CreateVideoStreams();
  246. } else {
  247. CreateVideoStreams();
  248. audio_receive_stream =
  249. receiver_call_->CreateAudioReceiveStream(audio_recv_config);
  250. }
  251. EXPECT_EQ(1u, video_receive_streams_.size());
  252. observer.set_receive_stream(video_receive_streams_[0]);
  253. drifting_clock = std::make_unique<DriftingClock>(clock_, video_ntp_speed);
  254. CreateFrameGeneratorCapturerWithDrift(drifting_clock.get(), video_rtp_speed,
  255. kDefaultFramerate, kDefaultWidth,
  256. kDefaultHeight);
  257. Start();
  258. audio_send_stream->Start();
  259. audio_receive_stream->Start();
  260. });
  261. EXPECT_TRUE(observer.Wait())
  262. << "Timed out while waiting for audio and video to be synchronized.";
  263. SendTask(RTC_FROM_HERE, task_queue(), [&]() {
  264. audio_send_stream->Stop();
  265. audio_receive_stream->Stop();
  266. Stop();
  267. DestroyStreams();
  268. video_send_transport.reset();
  269. audio_send_transport.reset();
  270. receive_transport.reset();
  271. sender_call_->DestroyAudioSendStream(audio_send_stream);
  272. receiver_call_->DestroyAudioReceiveStream(audio_receive_stream);
  273. DestroyCalls();
  274. });
  275. observer.PrintResults();
  276. // In quick test synchronization may not be achieved in time.
  277. if (!field_trial::IsEnabled("WebRTC-QuickPerfTest")) {
  278. // TODO(bugs.webrtc.org/10417): Reenable this for iOS
  279. #if !defined(WEBRTC_IOS)
  280. EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs"));
  281. #endif
  282. }
  283. }
  284. TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithoutClockDrift) {
  285. TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
  286. DriftingClock::kNoDrift, DriftingClock::kNoDrift,
  287. DriftingClock::kNoDrift, "_video_no_drift");
  288. }
  289. TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) {
  290. TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
  291. DriftingClock::PercentsFaster(10.0f),
  292. DriftingClock::kNoDrift, DriftingClock::kNoDrift,
  293. "_video_ntp_drift");
  294. }
  295. TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) {
  296. TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst,
  297. DriftingClock::kNoDrift,
  298. DriftingClock::PercentsSlower(30.0f),
  299. DriftingClock::PercentsFaster(30.0f), "_audio_faster");
  300. }
  301. TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoFasterThanAudioDrift) {
  302. TestAudioVideoSync(FecMode::kOn, CreateOrder::kVideoFirst,
  303. DriftingClock::kNoDrift,
  304. DriftingClock::PercentsFaster(30.0f),
  305. DriftingClock::PercentsSlower(30.0f), "_video_faster");
  306. }
  307. void CallPerfTest::TestCaptureNtpTime(
  308. const BuiltInNetworkBehaviorConfig& net_config,
  309. int threshold_ms,
  310. int start_time_ms,
  311. int run_time_ms) {
  312. class CaptureNtpTimeObserver : public test::EndToEndTest,
  313. public rtc::VideoSinkInterface<VideoFrame> {
  314. public:
  315. CaptureNtpTimeObserver(const BuiltInNetworkBehaviorConfig& net_config,
  316. int threshold_ms,
  317. int start_time_ms,
  318. int run_time_ms)
  319. : EndToEndTest(kLongTimeoutMs),
  320. net_config_(net_config),
  321. clock_(Clock::GetRealTimeClock()),
  322. threshold_ms_(threshold_ms),
  323. start_time_ms_(start_time_ms),
  324. run_time_ms_(run_time_ms),
  325. creation_time_ms_(clock_->TimeInMilliseconds()),
  326. capturer_(nullptr),
  327. rtp_start_timestamp_set_(false),
  328. rtp_start_timestamp_(0) {}
  329. private:
  330. std::unique_ptr<test::PacketTransport> CreateSendTransport(
  331. TaskQueueBase* task_queue,
  332. Call* sender_call) override {
  333. return std::make_unique<test::PacketTransport>(
  334. task_queue, sender_call, this, test::PacketTransport::kSender,
  335. payload_type_map_,
  336. std::make_unique<FakeNetworkPipe>(
  337. Clock::GetRealTimeClock(),
  338. std::make_unique<SimulatedNetwork>(net_config_)));
  339. }
  340. std::unique_ptr<test::PacketTransport> CreateReceiveTransport(
  341. TaskQueueBase* task_queue) override {
  342. return std::make_unique<test::PacketTransport>(
  343. task_queue, nullptr, this, test::PacketTransport::kReceiver,
  344. payload_type_map_,
  345. std::make_unique<FakeNetworkPipe>(
  346. Clock::GetRealTimeClock(),
  347. std::make_unique<SimulatedNetwork>(net_config_)));
  348. }
  349. void OnFrame(const VideoFrame& video_frame) override {
  350. rtc::CritScope lock(&crit_);
  351. if (video_frame.ntp_time_ms() <= 0) {
  352. // Haven't got enough RTCP SR in order to calculate the capture ntp
  353. // time.
  354. return;
  355. }
  356. int64_t now_ms = clock_->TimeInMilliseconds();
  357. int64_t time_since_creation = now_ms - creation_time_ms_;
  358. if (time_since_creation < start_time_ms_) {
  359. // Wait for |start_time_ms_| before start measuring.
  360. return;
  361. }
  362. if (time_since_creation > run_time_ms_) {
  363. observation_complete_.Set();
  364. }
  365. FrameCaptureTimeList::iterator iter =
  366. capture_time_list_.find(video_frame.timestamp());
  367. EXPECT_TRUE(iter != capture_time_list_.end());
  368. // The real capture time has been wrapped to uint32_t before converted
  369. // to rtp timestamp in the sender side. So here we convert the estimated
  370. // capture time to a uint32_t 90k timestamp also for comparing.
  371. uint32_t estimated_capture_timestamp =
  372. 90 * static_cast<uint32_t>(video_frame.ntp_time_ms());
  373. uint32_t real_capture_timestamp = iter->second;
  374. int time_offset_ms = real_capture_timestamp - estimated_capture_timestamp;
  375. time_offset_ms = time_offset_ms / 90;
  376. time_offset_ms_list_.push_back(time_offset_ms);
  377. EXPECT_TRUE(std::abs(time_offset_ms) < threshold_ms_);
  378. }
  379. Action OnSendRtp(const uint8_t* packet, size_t length) override {
  380. rtc::CritScope lock(&crit_);
  381. RTPHeader header;
  382. EXPECT_TRUE(parser_->Parse(packet, length, &header));
  383. if (!rtp_start_timestamp_set_) {
  384. // Calculate the rtp timestamp offset in order to calculate the real
  385. // capture time.
  386. uint32_t first_capture_timestamp =
  387. 90 * static_cast<uint32_t>(capturer_->first_frame_capture_time());
  388. rtp_start_timestamp_ = header.timestamp - first_capture_timestamp;
  389. rtp_start_timestamp_set_ = true;
  390. }
  391. uint32_t capture_timestamp = header.timestamp - rtp_start_timestamp_;
  392. capture_time_list_.insert(
  393. capture_time_list_.end(),
  394. std::make_pair(header.timestamp, capture_timestamp));
  395. return SEND_PACKET;
  396. }
  397. void OnFrameGeneratorCapturerCreated(
  398. test::FrameGeneratorCapturer* frame_generator_capturer) override {
  399. capturer_ = frame_generator_capturer;
  400. }
  401. void ModifyVideoConfigs(
  402. VideoSendStream::Config* send_config,
  403. std::vector<VideoReceiveStream::Config>* receive_configs,
  404. VideoEncoderConfig* encoder_config) override {
  405. (*receive_configs)[0].renderer = this;
  406. // Enable the receiver side rtt calculation.
  407. (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = true;
  408. }
  409. void PerformTest() override {
  410. EXPECT_TRUE(Wait()) << "Timed out while waiting for "
  411. "estimated capture NTP time to be "
  412. "within bounds.";
  413. test::PrintResultList("capture_ntp_time", "", "real - estimated",
  414. time_offset_ms_list_, "ms", true);
  415. }
  416. rtc::CriticalSection crit_;
  417. const BuiltInNetworkBehaviorConfig net_config_;
  418. Clock* const clock_;
  419. int threshold_ms_;
  420. int start_time_ms_;
  421. int run_time_ms_;
  422. int64_t creation_time_ms_;
  423. test::FrameGeneratorCapturer* capturer_;
  424. bool rtp_start_timestamp_set_;
  425. uint32_t rtp_start_timestamp_;
  426. typedef std::map<uint32_t, uint32_t> FrameCaptureTimeList;
  427. FrameCaptureTimeList capture_time_list_ RTC_GUARDED_BY(&crit_);
  428. std::vector<double> time_offset_ms_list_;
  429. } test(net_config, threshold_ms, start_time_ms, run_time_ms);
  430. RunBaseTest(&test);
  431. }
  432. // Flaky tests, disabled on Mac and Windows due to webrtc:8291.
  433. #if !(defined(WEBRTC_MAC) || defined(WEBRTC_WIN))
  434. TEST_F(CallPerfTest, CaptureNtpTimeWithNetworkDelay) {
  435. BuiltInNetworkBehaviorConfig net_config;
  436. net_config.queue_delay_ms = 100;
  437. // TODO(wu): lower the threshold as the calculation/estimatation becomes more
  438. // accurate.
  439. const int kThresholdMs = 100;
  440. const int kStartTimeMs = 10000;
  441. const int kRunTimeMs = 20000;
  442. TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
  443. }
  444. TEST_F(CallPerfTest, CaptureNtpTimeWithNetworkJitter) {
  445. BuiltInNetworkBehaviorConfig net_config;
  446. net_config.queue_delay_ms = 100;
  447. net_config.delay_standard_deviation_ms = 10;
  448. // TODO(wu): lower the threshold as the calculation/estimatation becomes more
  449. // accurate.
  450. const int kThresholdMs = 100;
  451. const int kStartTimeMs = 10000;
  452. const int kRunTimeMs = 20000;
  453. TestCaptureNtpTime(net_config, kThresholdMs, kStartTimeMs, kRunTimeMs);
  454. }
  455. #endif
  456. TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
  457. // Minimal normal usage at the start, then 30s overuse to allow filter to
  458. // settle, and then 80s underuse to allow plenty of time for rampup again.
  459. test::ScopedFieldTrials fake_overuse_settings(
  460. "WebRTC-ForceSimulatedOveruseIntervalMs/1-30000-80000/");
  461. class LoadObserver : public test::SendTest,
  462. public test::FrameGeneratorCapturer::SinkWantsObserver {
  463. public:
  464. LoadObserver() : SendTest(kLongTimeoutMs), test_phase_(TestPhase::kInit) {}
  465. void OnFrameGeneratorCapturerCreated(
  466. test::FrameGeneratorCapturer* frame_generator_capturer) override {
  467. frame_generator_capturer->SetSinkWantsObserver(this);
  468. // Set a high initial resolution to be sure that we can scale down.
  469. frame_generator_capturer->ChangeResolution(1920, 1080);
  470. }
  471. // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink
  472. // is called.
  473. // TODO(sprang): Add integration test for maintain-framerate mode?
  474. void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
  475. const rtc::VideoSinkWants& wants) override {
  476. // At kStart expect CPU overuse. Then expect CPU underuse when the encoder
  477. // delay has been decreased.
  478. switch (test_phase_) {
  479. case TestPhase::kInit:
  480. // Max framerate should be set initially.
  481. if (wants.max_framerate_fps != std::numeric_limits<int>::max() &&
  482. wants.max_pixel_count == std::numeric_limits<int>::max()) {
  483. test_phase_ = TestPhase::kStart;
  484. } else {
  485. ADD_FAILURE() << "Got unexpected adaptation request, max res = "
  486. << wants.max_pixel_count << ", target res = "
  487. << wants.target_pixel_count.value_or(-1)
  488. << ", max fps = " << wants.max_framerate_fps;
  489. }
  490. break;
  491. case TestPhase::kStart:
  492. if (wants.max_pixel_count < std::numeric_limits<int>::max()) {
  493. // On adapting down, VideoStreamEncoder::VideoSourceProxy will set
  494. // only the max pixel count, leaving the target unset.
  495. test_phase_ = TestPhase::kAdaptedDown;
  496. } else {
  497. ADD_FAILURE() << "Got unexpected adaptation request, max res = "
  498. << wants.max_pixel_count << ", target res = "
  499. << wants.target_pixel_count.value_or(-1)
  500. << ", max fps = " << wants.max_framerate_fps;
  501. }
  502. break;
  503. case TestPhase::kAdaptedDown:
  504. // On adapting up, the adaptation counter will again be at zero, and
  505. // so all constraints will be reset.
  506. if (wants.max_pixel_count == std::numeric_limits<int>::max() &&
  507. !wants.target_pixel_count) {
  508. test_phase_ = TestPhase::kAdaptedUp;
  509. observation_complete_.Set();
  510. } else {
  511. ADD_FAILURE() << "Got unexpected adaptation request, max res = "
  512. << wants.max_pixel_count << ", target res = "
  513. << wants.target_pixel_count.value_or(-1)
  514. << ", max fps = " << wants.max_framerate_fps;
  515. }
  516. break;
  517. case TestPhase::kAdaptedUp:
  518. ADD_FAILURE() << "Got unexpected adaptation request, max res = "
  519. << wants.max_pixel_count << ", target res = "
  520. << wants.target_pixel_count.value_or(-1)
  521. << ", max fps = " << wants.max_framerate_fps;
  522. }
  523. }
  524. void ModifyVideoConfigs(
  525. VideoSendStream::Config* send_config,
  526. std::vector<VideoReceiveStream::Config>* receive_configs,
  527. VideoEncoderConfig* encoder_config) override {}
  528. void PerformTest() override {
  529. EXPECT_TRUE(Wait()) << "Timed out before receiving an overuse callback.";
  530. }
  531. enum class TestPhase {
  532. kInit,
  533. kStart,
  534. kAdaptedDown,
  535. kAdaptedUp
  536. } test_phase_;
  537. } test;
  538. RunBaseTest(&test);
  539. }
  540. void CallPerfTest::TestMinTransmitBitrate(bool pad_to_min_bitrate) {
  541. static const int kMaxEncodeBitrateKbps = 30;
  542. static const int kMinTransmitBitrateBps = 150000;
  543. static const int kMinAcceptableTransmitBitrate = 130;
  544. static const int kMaxAcceptableTransmitBitrate = 170;
  545. static const int kNumBitrateObservationsInRange = 100;
  546. static const int kAcceptableBitrateErrorMargin = 15; // +- 7
  547. class BitrateObserver : public test::EndToEndTest {
  548. public:
  549. explicit BitrateObserver(bool using_min_transmit_bitrate)
  550. : EndToEndTest(kLongTimeoutMs),
  551. send_stream_(nullptr),
  552. converged_(false),
  553. pad_to_min_bitrate_(using_min_transmit_bitrate),
  554. min_acceptable_bitrate_(using_min_transmit_bitrate
  555. ? kMinAcceptableTransmitBitrate
  556. : (kMaxEncodeBitrateKbps -
  557. kAcceptableBitrateErrorMargin / 2)),
  558. max_acceptable_bitrate_(using_min_transmit_bitrate
  559. ? kMaxAcceptableTransmitBitrate
  560. : (kMaxEncodeBitrateKbps +
  561. kAcceptableBitrateErrorMargin / 2)),
  562. num_bitrate_observations_in_range_(0) {}
  563. private:
  564. // TODO(holmer): Run this with a timer instead of once per packet.
  565. Action OnSendRtp(const uint8_t* packet, size_t length) override {
  566. VideoSendStream::Stats stats = send_stream_->GetStats();
  567. if (!stats.substreams.empty()) {
  568. RTC_DCHECK_EQ(1, stats.substreams.size());
  569. int bitrate_kbps =
  570. stats.substreams.begin()->second.total_bitrate_bps / 1000;
  571. if (bitrate_kbps > min_acceptable_bitrate_ &&
  572. bitrate_kbps < max_acceptable_bitrate_) {
  573. converged_ = true;
  574. ++num_bitrate_observations_in_range_;
  575. if (num_bitrate_observations_in_range_ ==
  576. kNumBitrateObservationsInRange)
  577. observation_complete_.Set();
  578. }
  579. if (converged_)
  580. bitrate_kbps_list_.push_back(bitrate_kbps);
  581. }
  582. return SEND_PACKET;
  583. }
  584. void OnVideoStreamsCreated(
  585. VideoSendStream* send_stream,
  586. const std::vector<VideoReceiveStream*>& receive_streams) override {
  587. send_stream_ = send_stream;
  588. }
  589. void ModifyVideoConfigs(
  590. VideoSendStream::Config* send_config,
  591. std::vector<VideoReceiveStream::Config>* receive_configs,
  592. VideoEncoderConfig* encoder_config) override {
  593. if (pad_to_min_bitrate_) {
  594. encoder_config->min_transmit_bitrate_bps = kMinTransmitBitrateBps;
  595. } else {
  596. RTC_DCHECK_EQ(0, encoder_config->min_transmit_bitrate_bps);
  597. }
  598. }
  599. void PerformTest() override {
  600. EXPECT_TRUE(Wait()) << "Timeout while waiting for send-bitrate stats.";
  601. test::PrintResultList(
  602. "bitrate_stats_",
  603. (pad_to_min_bitrate_ ? "min_transmit_bitrate"
  604. : "without_min_transmit_bitrate"),
  605. "bitrate_kbps", bitrate_kbps_list_, "kbps", false);
  606. }
  607. VideoSendStream* send_stream_;
  608. bool converged_;
  609. const bool pad_to_min_bitrate_;
  610. const int min_acceptable_bitrate_;
  611. const int max_acceptable_bitrate_;
  612. int num_bitrate_observations_in_range_;
  613. std::vector<double> bitrate_kbps_list_;
  614. } test(pad_to_min_bitrate);
  615. fake_encoder_max_bitrate_ = kMaxEncodeBitrateKbps;
  616. RunBaseTest(&test);
  617. }
  618. TEST_F(CallPerfTest, PadsToMinTransmitBitrate) {
  619. TestMinTransmitBitrate(true);
  620. }
  621. TEST_F(CallPerfTest, NoPadWithoutMinTransmitBitrate) {
  622. TestMinTransmitBitrate(false);
  623. }
  624. // TODO(bugs.webrtc.org/8878)
  625. #if defined(WEBRTC_MAC)
  626. #define MAYBE_KeepsHighBitrateWhenReconfiguringSender \
  627. DISABLED_KeepsHighBitrateWhenReconfiguringSender
  628. #else
  629. #define MAYBE_KeepsHighBitrateWhenReconfiguringSender \
  630. KeepsHighBitrateWhenReconfiguringSender
  631. #endif
  632. TEST_F(CallPerfTest, MAYBE_KeepsHighBitrateWhenReconfiguringSender) {
  633. static const uint32_t kInitialBitrateKbps = 400;
  634. static const uint32_t kReconfigureThresholdKbps = 600;
  635. class VideoStreamFactory
  636. : public VideoEncoderConfig::VideoStreamFactoryInterface {
  637. public:
  638. VideoStreamFactory() {}
  639. private:
  640. std::vector<VideoStream> CreateEncoderStreams(
  641. int width,
  642. int height,
  643. const VideoEncoderConfig& encoder_config) override {
  644. std::vector<VideoStream> streams =
  645. test::CreateVideoStreams(width, height, encoder_config);
  646. streams[0].min_bitrate_bps = 50000;
  647. streams[0].target_bitrate_bps = streams[0].max_bitrate_bps = 2000000;
  648. return streams;
  649. }
  650. };
  651. class BitrateObserver : public test::EndToEndTest, public test::FakeEncoder {
  652. public:
  653. BitrateObserver()
  654. : EndToEndTest(kDefaultTimeoutMs),
  655. FakeEncoder(Clock::GetRealTimeClock()),
  656. encoder_inits_(0),
  657. last_set_bitrate_kbps_(0),
  658. send_stream_(nullptr),
  659. frame_generator_(nullptr),
  660. encoder_factory_(this),
  661. bitrate_allocator_factory_(
  662. CreateBuiltinVideoBitrateAllocatorFactory()) {}
  663. int32_t InitEncode(const VideoCodec* config,
  664. const VideoEncoder::Settings& settings) override {
  665. ++encoder_inits_;
  666. if (encoder_inits_ == 1) {
  667. // First time initialization. Frame size is known.
  668. // |expected_bitrate| is affected by bandwidth estimation before the
  669. // first frame arrives to the encoder.
  670. uint32_t expected_bitrate = last_set_bitrate_kbps_ > 0
  671. ? last_set_bitrate_kbps_
  672. : kInitialBitrateKbps;
  673. EXPECT_EQ(expected_bitrate, config->startBitrate)
  674. << "Encoder not initialized at expected bitrate.";
  675. EXPECT_EQ(kDefaultWidth, config->width);
  676. EXPECT_EQ(kDefaultHeight, config->height);
  677. } else if (encoder_inits_ == 2) {
  678. EXPECT_EQ(2 * kDefaultWidth, config->width);
  679. EXPECT_EQ(2 * kDefaultHeight, config->height);
  680. EXPECT_GE(last_set_bitrate_kbps_, kReconfigureThresholdKbps);
  681. EXPECT_GT(config->startBitrate, kReconfigureThresholdKbps)
  682. << "Encoder reconfigured with bitrate too far away from last set.";
  683. observation_complete_.Set();
  684. }
  685. return FakeEncoder::InitEncode(config, settings);
  686. }
  687. void SetRates(const RateControlParameters& parameters) override {
  688. last_set_bitrate_kbps_ = parameters.bitrate.get_sum_kbps();
  689. if (encoder_inits_ == 1 &&
  690. parameters.bitrate.get_sum_kbps() > kReconfigureThresholdKbps) {
  691. time_to_reconfigure_.Set();
  692. }
  693. FakeEncoder::SetRates(parameters);
  694. }
  695. void ModifySenderBitrateConfig(
  696. BitrateConstraints* bitrate_config) override {
  697. bitrate_config->start_bitrate_bps = kInitialBitrateKbps * 1000;
  698. }
  699. void ModifyVideoConfigs(
  700. VideoSendStream::Config* send_config,
  701. std::vector<VideoReceiveStream::Config>* receive_configs,
  702. VideoEncoderConfig* encoder_config) override {
  703. send_config->encoder_settings.encoder_factory = &encoder_factory_;
  704. send_config->encoder_settings.bitrate_allocator_factory =
  705. bitrate_allocator_factory_.get();
  706. encoder_config->max_bitrate_bps = 2 * kReconfigureThresholdKbps * 1000;
  707. encoder_config->video_stream_factory =
  708. new rtc::RefCountedObject<VideoStreamFactory>();
  709. encoder_config_ = encoder_config->Copy();
  710. }
  711. void OnVideoStreamsCreated(
  712. VideoSendStream* send_stream,
  713. const std::vector<VideoReceiveStream*>& receive_streams) override {
  714. send_stream_ = send_stream;
  715. }
  716. void OnFrameGeneratorCapturerCreated(
  717. test::FrameGeneratorCapturer* frame_generator_capturer) override {
  718. frame_generator_ = frame_generator_capturer;
  719. }
  720. void PerformTest() override {
  721. ASSERT_TRUE(time_to_reconfigure_.Wait(kDefaultTimeoutMs))
  722. << "Timed out before receiving an initial high bitrate.";
  723. frame_generator_->ChangeResolution(kDefaultWidth * 2, kDefaultHeight * 2);
  724. send_stream_->ReconfigureVideoEncoder(encoder_config_.Copy());
  725. EXPECT_TRUE(Wait())
  726. << "Timed out while waiting for a couple of high bitrate estimates "
  727. "after reconfiguring the send stream.";
  728. }
  729. private:
  730. rtc::Event time_to_reconfigure_;
  731. int encoder_inits_;
  732. uint32_t last_set_bitrate_kbps_;
  733. VideoSendStream* send_stream_;
  734. test::FrameGeneratorCapturer* frame_generator_;
  735. test::VideoEncoderProxyFactory encoder_factory_;
  736. std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_;
  737. VideoEncoderConfig encoder_config_;
  738. } test;
  739. RunBaseTest(&test);
  740. }
  741. // Discovers the minimal supported audio+video bitrate. The test bitrate is
  742. // considered supported if Rtt does not go above 400ms with the network
  743. // contrained to the test bitrate.
  744. //
  745. // |test_bitrate_from test_bitrate_to| bitrate constraint range
  746. // |test_bitrate_step| bitrate constraint update step during the test
  747. // |min_bwe max_bwe| BWE range
  748. // |start_bwe| initial BWE
  749. void CallPerfTest::TestMinAudioVideoBitrate(int test_bitrate_from,
  750. int test_bitrate_to,
  751. int test_bitrate_step,
  752. int min_bwe,
  753. int start_bwe,
  754. int max_bwe) {
  755. static const std::string kAudioTrackId = "audio_track_0";
  756. static constexpr int kOpusBitrateFbBps = 32000;
  757. static constexpr int kBitrateStabilizationMs = 10000;
  758. static constexpr int kBitrateMeasurements = 10;
  759. static constexpr int kBitrateMeasurementMs = 1000;
  760. static constexpr int kShortDelayMs = 10;
  761. static constexpr int kMinGoodRttMs = 400;
  762. class MinVideoAndAudioBitrateTester : public test::EndToEndTest {
  763. public:
  764. MinVideoAndAudioBitrateTester(int test_bitrate_from,
  765. int test_bitrate_to,
  766. int test_bitrate_step,
  767. int min_bwe,
  768. int start_bwe,
  769. int max_bwe,
  770. TaskQueueBase* task_queue)
  771. : EndToEndTest(),
  772. test_bitrate_from_(test_bitrate_from),
  773. test_bitrate_to_(test_bitrate_to),
  774. test_bitrate_step_(test_bitrate_step),
  775. min_bwe_(min_bwe),
  776. start_bwe_(start_bwe),
  777. max_bwe_(max_bwe),
  778. task_queue_(task_queue) {}
  779. protected:
  780. BuiltInNetworkBehaviorConfig GetFakeNetworkPipeConfig() {
  781. BuiltInNetworkBehaviorConfig pipe_config;
  782. pipe_config.link_capacity_kbps = test_bitrate_from_;
  783. return pipe_config;
  784. }
  785. std::unique_ptr<test::PacketTransport> CreateSendTransport(
  786. TaskQueueBase* task_queue,
  787. Call* sender_call) override {
  788. auto network =
  789. std::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
  790. send_simulated_network_ = network.get();
  791. return std::make_unique<test::PacketTransport>(
  792. task_queue, sender_call, this, test::PacketTransport::kSender,
  793. test::CallTest::payload_type_map_,
  794. std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
  795. std::move(network)));
  796. }
  797. std::unique_ptr<test::PacketTransport> CreateReceiveTransport(
  798. TaskQueueBase* task_queue) override {
  799. auto network =
  800. std::make_unique<SimulatedNetwork>(GetFakeNetworkPipeConfig());
  801. receive_simulated_network_ = network.get();
  802. return std::make_unique<test::PacketTransport>(
  803. task_queue, nullptr, this, test::PacketTransport::kReceiver,
  804. test::CallTest::payload_type_map_,
  805. std::make_unique<FakeNetworkPipe>(Clock::GetRealTimeClock(),
  806. std::move(network)));
  807. }
  808. void PerformTest() override {
  809. // Quick test mode, just to exercise all the code paths without actually
  810. // caring about performance measurements.
  811. const bool quick_perf_test =
  812. field_trial::IsEnabled("WebRTC-QuickPerfTest");
  813. int last_passed_test_bitrate = -1;
  814. for (int test_bitrate = test_bitrate_from_;
  815. test_bitrate_from_ < test_bitrate_to_
  816. ? test_bitrate <= test_bitrate_to_
  817. : test_bitrate >= test_bitrate_to_;
  818. test_bitrate += test_bitrate_step_) {
  819. BuiltInNetworkBehaviorConfig pipe_config;
  820. pipe_config.link_capacity_kbps = test_bitrate;
  821. send_simulated_network_->SetConfig(pipe_config);
  822. receive_simulated_network_->SetConfig(pipe_config);
  823. rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs
  824. : kBitrateStabilizationMs);
  825. int64_t avg_rtt = 0;
  826. for (int i = 0; i < kBitrateMeasurements; i++) {
  827. Call::Stats call_stats;
  828. SendTask(RTC_FROM_HERE, task_queue_, [this, &call_stats]() {
  829. call_stats = sender_call_->GetStats();
  830. });
  831. avg_rtt += call_stats.rtt_ms;
  832. rtc::Thread::SleepMs(quick_perf_test ? kShortDelayMs
  833. : kBitrateMeasurementMs);
  834. }
  835. avg_rtt = avg_rtt / kBitrateMeasurements;
  836. if (avg_rtt > kMinGoodRttMs) {
  837. break;
  838. } else {
  839. last_passed_test_bitrate = test_bitrate;
  840. }
  841. }
  842. EXPECT_GT(last_passed_test_bitrate, -1)
  843. << "Minimum supported bitrate out of the test scope";
  844. webrtc::test::PrintResult("min_test_bitrate_", "", "min_bitrate",
  845. last_passed_test_bitrate, "kbps", false);
  846. }
  847. void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
  848. sender_call_ = sender_call;
  849. BitrateConstraints bitrate_config;
  850. bitrate_config.min_bitrate_bps = min_bwe_;
  851. bitrate_config.start_bitrate_bps = start_bwe_;
  852. bitrate_config.max_bitrate_bps = max_bwe_;
  853. sender_call->GetTransportControllerSend()->SetSdpBitrateParameters(
  854. bitrate_config);
  855. }
  856. size_t GetNumVideoStreams() const override { return 1; }
  857. size_t GetNumAudioStreams() const override { return 1; }
  858. void ModifyAudioConfigs(
  859. AudioSendStream::Config* send_config,
  860. std::vector<AudioReceiveStream::Config>* receive_configs) override {
  861. send_config->send_codec_spec->target_bitrate_bps =
  862. absl::optional<int>(kOpusBitrateFbBps);
  863. }
  864. private:
  865. const int test_bitrate_from_;
  866. const int test_bitrate_to_;
  867. const int test_bitrate_step_;
  868. const int min_bwe_;
  869. const int start_bwe_;
  870. const int max_bwe_;
  871. SimulatedNetwork* send_simulated_network_;
  872. SimulatedNetwork* receive_simulated_network_;
  873. Call* sender_call_;
  874. TaskQueueBase* const task_queue_;
  875. } test(test_bitrate_from, test_bitrate_to, test_bitrate_step, min_bwe,
  876. start_bwe, max_bwe, task_queue());
  877. RunBaseTest(&test);
  878. }
  879. // TODO(bugs.webrtc.org/8878)
  880. #if defined(WEBRTC_MAC)
  881. #define MAYBE_MinVideoAndAudioBitrate DISABLED_MinVideoAndAudioBitrate
  882. #else
  883. #define MAYBE_MinVideoAndAudioBitrate MinVideoAndAudioBitrate
  884. #endif
  885. TEST_F(CallPerfTest, MAYBE_MinVideoAndAudioBitrate) {
  886. TestMinAudioVideoBitrate(110, 40, -10, 10000, 70000, 200000);
  887. }
  888. } // namespace webrtc