OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <limits> | 12 #include <limits> |
13 #include <memory> | 13 #include <memory> |
14 #include <sstream> | 14 #include <sstream> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
22 #include "webrtc/call.h" | 22 #include "webrtc/call.h" |
23 #include "webrtc/call/transport_adapter.h" | 23 #include "webrtc/call/transport_adapter.h" |
24 #include "webrtc/config.h" | 24 #include "webrtc/config.h" |
25 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 25 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 28 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
| 29 #include "webrtc/system_wrappers/include/metrics_default.h" |
29 #include "webrtc/system_wrappers/include/rtp_to_ntp.h" | 30 #include "webrtc/system_wrappers/include/rtp_to_ntp.h" |
30 #include "webrtc/test/call_test.h" | 31 #include "webrtc/test/call_test.h" |
31 #include "webrtc/test/direct_transport.h" | 32 #include "webrtc/test/direct_transport.h" |
32 #include "webrtc/test/drifting_clock.h" | 33 #include "webrtc/test/drifting_clock.h" |
33 #include "webrtc/test/encoder_settings.h" | 34 #include "webrtc/test/encoder_settings.h" |
34 #include "webrtc/test/fake_audio_device.h" | 35 #include "webrtc/test/fake_audio_device.h" |
35 #include "webrtc/test/fake_decoder.h" | 36 #include "webrtc/test/fake_decoder.h" |
36 #include "webrtc/test/fake_encoder.h" | 37 #include "webrtc/test/fake_encoder.h" |
37 #include "webrtc/test/frame_generator.h" | 38 #include "webrtc/test/frame_generator.h" |
38 #include "webrtc/test/frame_generator_capturer.h" | 39 #include "webrtc/test/frame_generator_capturer.h" |
39 #include "webrtc/test/histogram.h" | |
40 #include "webrtc/test/rtp_rtcp_observer.h" | 40 #include "webrtc/test/rtp_rtcp_observer.h" |
41 #include "webrtc/test/testsupport/fileutils.h" | 41 #include "webrtc/test/testsupport/fileutils.h" |
42 #include "webrtc/test/testsupport/perf_test.h" | 42 #include "webrtc/test/testsupport/perf_test.h" |
43 #include "webrtc/voice_engine/include/voe_base.h" | 43 #include "webrtc/voice_engine/include/voe_base.h" |
44 #include "webrtc/voice_engine/include/voe_codec.h" | 44 #include "webrtc/voice_engine/include/voe_codec.h" |
45 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 45 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
46 #include "webrtc/voice_engine/include/voe_video_sync.h" | 46 #include "webrtc/voice_engine/include/voe_video_sync.h" |
47 | 47 |
48 using webrtc::test::DriftingClock; | 48 using webrtc::test::DriftingClock; |
49 using webrtc::test::FakeAudioDevice; | 49 using webrtc::test::FakeAudioDevice; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 void CallPerfTest::TestAudioVideoSync(FecMode fec, | 144 void CallPerfTest::TestAudioVideoSync(FecMode fec, |
145 CreateOrder create_first, | 145 CreateOrder create_first, |
146 float video_ntp_speed, | 146 float video_ntp_speed, |
147 float video_rtp_speed, | 147 float video_rtp_speed, |
148 float audio_rtp_speed) { | 148 float audio_rtp_speed) { |
149 const char* kSyncGroup = "av_sync"; | 149 const char* kSyncGroup = "av_sync"; |
150 const uint32_t kAudioSendSsrc = 1234; | 150 const uint32_t kAudioSendSsrc = 1234; |
151 const uint32_t kAudioRecvSsrc = 5678; | 151 const uint32_t kAudioRecvSsrc = 5678; |
152 | 152 |
153 test::ClearHistograms(); | 153 metrics::Reset(); |
154 VoiceEngine* voice_engine = VoiceEngine::Create(); | 154 VoiceEngine* voice_engine = VoiceEngine::Create(); |
155 VoEBase* voe_base = VoEBase::GetInterface(voice_engine); | 155 VoEBase* voe_base = VoEBase::GetInterface(voice_engine); |
156 VoECodec* voe_codec = VoECodec::GetInterface(voice_engine); | 156 VoECodec* voe_codec = VoECodec::GetInterface(voice_engine); |
157 const std::string audio_filename = | 157 const std::string audio_filename = |
158 test::ResourcePath("voice_engine/audio_long16", "pcm"); | 158 test::ResourcePath("voice_engine/audio_long16", "pcm"); |
159 ASSERT_STRNE("", audio_filename.c_str()); | 159 ASSERT_STRNE("", audio_filename.c_str()); |
160 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, | 160 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, |
161 audio_rtp_speed); | 161 audio_rtp_speed); |
162 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr)); | 162 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr)); |
163 Config voe_config; | 163 Config voe_config; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 voe_base->DeleteChannel(send_channel_id); | 294 voe_base->DeleteChannel(send_channel_id); |
295 voe_base->DeleteChannel(recv_channel_id); | 295 voe_base->DeleteChannel(recv_channel_id); |
296 voe_base->Release(); | 296 voe_base->Release(); |
297 voe_codec->Release(); | 297 voe_codec->Release(); |
298 | 298 |
299 DestroyCalls(); | 299 DestroyCalls(); |
300 | 300 |
301 VoiceEngine::Delete(voice_engine); | 301 VoiceEngine::Delete(voice_engine); |
302 | 302 |
303 EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.AVSyncOffsetInMs")); | 303 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs")); |
304 } | 304 } |
305 | 305 |
306 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { | 306 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { |
307 TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, | 307 TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |
308 DriftingClock::PercentsFaster(10.0f), | 308 DriftingClock::PercentsFaster(10.0f), |
309 DriftingClock::kNoDrift, DriftingClock::kNoDrift); | 309 DriftingClock::kNoDrift, DriftingClock::kNoDrift); |
310 } | 310 } |
311 | 311 |
312 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) { | 312 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) { |
313 TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, | 313 TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 int encoder_inits_; | 693 int encoder_inits_; |
694 uint32_t last_set_bitrate_; | 694 uint32_t last_set_bitrate_; |
695 VideoSendStream* send_stream_; | 695 VideoSendStream* send_stream_; |
696 VideoEncoderConfig encoder_config_; | 696 VideoEncoderConfig encoder_config_; |
697 } test; | 697 } test; |
698 | 698 |
699 RunBaseTest(&test); | 699 RunBaseTest(&test); |
700 } | 700 } |
701 | 701 |
702 } // namespace webrtc | 702 } // namespace webrtc |
OLD | NEW |