| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "webrtc/test/fake_audio_device.h" | 33 #include "webrtc/test/fake_audio_device.h" |
| 34 #include "webrtc/test/fake_decoder.h" | 34 #include "webrtc/test/fake_decoder.h" |
| 35 #include "webrtc/test/fake_encoder.h" | 35 #include "webrtc/test/fake_encoder.h" |
| 36 #include "webrtc/test/frame_generator.h" | 36 #include "webrtc/test/frame_generator.h" |
| 37 #include "webrtc/test/frame_generator_capturer.h" | 37 #include "webrtc/test/frame_generator_capturer.h" |
| 38 #include "webrtc/test/gtest.h" | 38 #include "webrtc/test/gtest.h" |
| 39 #include "webrtc/test/rtp_rtcp_observer.h" | 39 #include "webrtc/test/rtp_rtcp_observer.h" |
| 40 #include "webrtc/test/testsupport/fileutils.h" | 40 #include "webrtc/test/testsupport/fileutils.h" |
| 41 #include "webrtc/test/testsupport/perf_test.h" | 41 #include "webrtc/test/testsupport/perf_test.h" |
| 42 #include "webrtc/voice_engine/include/voe_base.h" | 42 #include "webrtc/voice_engine/include/voe_base.h" |
| 43 #include "webrtc/voice_engine/include/voe_codec.h" | |
| 44 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | |
| 45 #include "webrtc/voice_engine/include/voe_video_sync.h" | |
| 46 | 43 |
| 47 using webrtc::test::DriftingClock; | 44 using webrtc::test::DriftingClock; |
| 48 using webrtc::test::FakeAudioDevice; | 45 using webrtc::test::FakeAudioDevice; |
| 49 | 46 |
| 50 namespace webrtc { | 47 namespace webrtc { |
| 51 | 48 |
| 52 class CallPerfTest : public test::CallTest { | 49 class CallPerfTest : public test::CallTest { |
| 53 protected: | 50 protected: |
| 54 enum class FecMode { | 51 enum class FecMode { |
| 55 kOn, kOff | 52 kOn, kOff |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 float video_ntp_speed, | 142 float video_ntp_speed, |
| 146 float video_rtp_speed, | 143 float video_rtp_speed, |
| 147 float audio_rtp_speed) { | 144 float audio_rtp_speed) { |
| 148 const char* kSyncGroup = "av_sync"; | 145 const char* kSyncGroup = "av_sync"; |
| 149 const uint32_t kAudioSendSsrc = 1234; | 146 const uint32_t kAudioSendSsrc = 1234; |
| 150 const uint32_t kAudioRecvSsrc = 5678; | 147 const uint32_t kAudioRecvSsrc = 5678; |
| 151 | 148 |
| 152 metrics::Reset(); | 149 metrics::Reset(); |
| 153 VoiceEngine* voice_engine = VoiceEngine::Create(); | 150 VoiceEngine* voice_engine = VoiceEngine::Create(); |
| 154 VoEBase* voe_base = VoEBase::GetInterface(voice_engine); | 151 VoEBase* voe_base = VoEBase::GetInterface(voice_engine); |
| 155 VoECodec* voe_codec = VoECodec::GetInterface(voice_engine); | |
| 156 const std::string audio_filename = | 152 const std::string audio_filename = |
| 157 test::ResourcePath("voice_engine/audio_long16", "pcm"); | 153 test::ResourcePath("voice_engine/audio_long16", "pcm"); |
| 158 ASSERT_STRNE("", audio_filename.c_str()); | 154 ASSERT_STRNE("", audio_filename.c_str()); |
| 159 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, | 155 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, |
| 160 audio_rtp_speed); | 156 audio_rtp_speed); |
| 161 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr, decoder_factory_)); | 157 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr, decoder_factory_)); |
| 162 VoEBase::ChannelConfig config; | 158 VoEBase::ChannelConfig config; |
| 163 config.enable_voice_pacing = true; | 159 config.enable_voice_pacing = true; |
| 164 int send_channel_id = voe_base->CreateChannel(config); | 160 int send_channel_id = voe_base->CreateChannel(config); |
| 165 int recv_channel_id = voe_base->CreateChannel(); | 161 int recv_channel_id = voe_base->CreateChannel(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 receive_transport.SetReceiver(sender_call_->Receiver()); | 215 receive_transport.SetReceiver(sender_call_->Receiver()); |
| 220 | 216 |
| 221 test::FakeDecoder fake_decoder; | 217 test::FakeDecoder fake_decoder; |
| 222 | 218 |
| 223 CreateSendConfig(1, 0, &video_send_transport); | 219 CreateSendConfig(1, 0, &video_send_transport); |
| 224 CreateMatchingReceiveConfigs(&receive_transport); | 220 CreateMatchingReceiveConfigs(&receive_transport); |
| 225 | 221 |
| 226 AudioSendStream::Config audio_send_config(&audio_send_transport); | 222 AudioSendStream::Config audio_send_config(&audio_send_transport); |
| 227 audio_send_config.voe_channel_id = send_channel_id; | 223 audio_send_config.voe_channel_id = send_channel_id; |
| 228 audio_send_config.rtp.ssrc = kAudioSendSsrc; | 224 audio_send_config.rtp.ssrc = kAudioSendSsrc; |
| 225 audio_send_config.send_codec_spec.codec_inst = |
| 226 CodecInst{103, "ISAC", 16000, 480, 1, 32000}; |
| 229 AudioSendStream* audio_send_stream = | 227 AudioSendStream* audio_send_stream = |
| 230 sender_call_->CreateAudioSendStream(audio_send_config); | 228 sender_call_->CreateAudioSendStream(audio_send_config); |
| 231 | 229 |
| 232 CodecInst isac = {103, "ISAC", 16000, 480, 1, 32000}; | |
| 233 EXPECT_EQ(0, voe_codec->SetSendCodec(send_channel_id, isac)); | |
| 234 | |
| 235 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 230 video_send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 236 if (fec == FecMode::kOn) { | 231 if (fec == FecMode::kOn) { |
| 237 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; | 232 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 238 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; | 233 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType; |
| 239 video_receive_configs_[0].rtp.ulpfec.red_payload_type = kRedPayloadType; | 234 video_receive_configs_[0].rtp.ulpfec.red_payload_type = kRedPayloadType; |
| 240 video_receive_configs_[0].rtp.ulpfec.ulpfec_payload_type = | 235 video_receive_configs_[0].rtp.ulpfec.ulpfec_payload_type = |
| 241 kUlpfecPayloadType; | 236 kUlpfecPayloadType; |
| 242 } | 237 } |
| 243 video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000; | 238 video_receive_configs_[0].rtp.nack.rtp_history_ms = 1000; |
| 244 video_receive_configs_[0].renderer = &observer; | 239 video_receive_configs_[0].renderer = &observer; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 receive_transport.StopSending(); | 285 receive_transport.StopSending(); |
| 291 | 286 |
| 292 DestroyStreams(); | 287 DestroyStreams(); |
| 293 | 288 |
| 294 sender_call_->DestroyAudioSendStream(audio_send_stream); | 289 sender_call_->DestroyAudioSendStream(audio_send_stream); |
| 295 receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); | 290 receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); |
| 296 | 291 |
| 297 voe_base->DeleteChannel(send_channel_id); | 292 voe_base->DeleteChannel(send_channel_id); |
| 298 voe_base->DeleteChannel(recv_channel_id); | 293 voe_base->DeleteChannel(recv_channel_id); |
| 299 voe_base->Release(); | 294 voe_base->Release(); |
| 300 voe_codec->Release(); | |
| 301 | 295 |
| 302 DestroyCalls(); | 296 DestroyCalls(); |
| 303 | 297 |
| 304 VoiceEngine::Delete(voice_engine); | 298 VoiceEngine::Delete(voice_engine); |
| 305 | 299 |
| 306 observer.PrintResults(); | 300 observer.PrintResults(); |
| 307 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs")); | 301 EXPECT_EQ(1, metrics::NumSamples("WebRTC.Video.AVSyncOffsetInMs")); |
| 308 } | 302 } |
| 309 | 303 |
| 310 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { | 304 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 uint32_t last_set_bitrate_; | 723 uint32_t last_set_bitrate_; |
| 730 VideoSendStream* send_stream_; | 724 VideoSendStream* send_stream_; |
| 731 test::FrameGeneratorCapturer* frame_generator_; | 725 test::FrameGeneratorCapturer* frame_generator_; |
| 732 VideoEncoderConfig encoder_config_; | 726 VideoEncoderConfig encoder_config_; |
| 733 } test; | 727 } test; |
| 734 | 728 |
| 735 RunBaseTest(&test); | 729 RunBaseTest(&test); |
| 736 } | 730 } |
| 737 | 731 |
| 738 } // namespace webrtc | 732 } // namespace webrtc |
| OLD | NEW |