| 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 #include <algorithm> | 10 #include <algorithm> | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 37 #include "webrtc/voice_engine/include/voe_base.h" | 37 #include "webrtc/voice_engine/include/voe_base.h" | 
| 38 #include "webrtc/voice_engine/include/voe_codec.h" | 38 #include "webrtc/voice_engine/include/voe_codec.h" | 
| 39 #include "webrtc/voice_engine/include/voe_network.h" | 39 #include "webrtc/voice_engine/include/voe_network.h" | 
| 40 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 40 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 
| 41 #include "webrtc/voice_engine/include/voe_video_sync.h" | 41 #include "webrtc/voice_engine/include/voe_video_sync.h" | 
| 42 | 42 | 
| 43 namespace webrtc { | 43 namespace webrtc { | 
| 44 | 44 | 
| 45 class CallPerfTest : public test::CallTest { | 45 class CallPerfTest : public test::CallTest { | 
| 46  protected: | 46  protected: | 
| 47   void TestAudioVideoSync(bool fec); | 47   void TestAudioVideoSync(bool fec, bool create_audio_first); | 
| 48 | 48 | 
| 49   void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms); | 49   void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms); | 
| 50 | 50 | 
| 51   void TestMinTransmitBitrate(bool pad_to_min_bitrate); | 51   void TestMinTransmitBitrate(bool pad_to_min_bitrate); | 
| 52 | 52 | 
| 53   void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, | 53   void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, | 
| 54                           int threshold_ms, | 54                           int threshold_ms, | 
| 55                           int start_time_ms, | 55                           int start_time_ms, | 
| 56                           int run_time_ms); | 56                           int run_time_ms); | 
| 57 }; | 57 }; | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 182 | 182 | 
| 183  private: | 183  private: | 
| 184   Clock* const clock_; | 184   Clock* const clock_; | 
| 185   int voe_channel_; | 185   int voe_channel_; | 
| 186   VoEVideoSync* voe_sync_; | 186   VoEVideoSync* voe_sync_; | 
| 187   SyncRtcpObserver* audio_observer_; | 187   SyncRtcpObserver* audio_observer_; | 
| 188   int64_t creation_time_ms_; | 188   int64_t creation_time_ms_; | 
| 189   int64_t first_time_in_sync_; | 189   int64_t first_time_in_sync_; | 
| 190 }; | 190 }; | 
| 191 | 191 | 
| 192 void CallPerfTest::TestAudioVideoSync(bool fec) { | 192 void CallPerfTest::TestAudioVideoSync(bool fec, bool create_audio_first) { | 
|  | 193   const char* kSyncGroup = "av_sync"; | 
| 193   class AudioPacketReceiver : public PacketReceiver { | 194   class AudioPacketReceiver : public PacketReceiver { | 
| 194    public: | 195    public: | 
| 195     AudioPacketReceiver(int channel, VoENetwork* voe_network) | 196     AudioPacketReceiver(int channel, VoENetwork* voe_network) | 
| 196         : channel_(channel), | 197         : channel_(channel), | 
| 197           voe_network_(voe_network), | 198           voe_network_(voe_network), | 
| 198           parser_(RtpHeaderParser::Create()) {} | 199           parser_(RtpHeaderParser::Create()) {} | 
| 199     DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, | 200     DeliveryStatus DeliverPacket(MediaType media_type, const uint8_t* packet, | 
| 200                                  size_t length) override { | 201                                  size_t length) override { | 
| 201       EXPECT_TRUE(media_type == MediaType::ANY || | 202       EXPECT_TRUE(media_type == MediaType::ANY || | 
| 202                   media_type == MediaType::AUDIO); | 203                   media_type == MediaType::AUDIO); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 262 | 263 | 
| 263   send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 264   send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 
| 264   if (fec) { | 265   if (fec) { | 
| 265     send_config_.rtp.fec.red_payload_type = kRedPayloadType; | 266     send_config_.rtp.fec.red_payload_type = kRedPayloadType; | 
| 266     send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 267     send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 
| 267     receive_configs_[0].rtp.fec.red_payload_type = kRedPayloadType; | 268     receive_configs_[0].rtp.fec.red_payload_type = kRedPayloadType; | 
| 268     receive_configs_[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 269     receive_configs_[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 
| 269   } | 270   } | 
| 270   receive_configs_[0].rtp.nack.rtp_history_ms = 1000; | 271   receive_configs_[0].rtp.nack.rtp_history_ms = 1000; | 
| 271   receive_configs_[0].renderer = &observer; | 272   receive_configs_[0].renderer = &observer; | 
| 272   receive_configs_[0].audio_channel_id = channel; | 273   receive_configs_[0].sync_group = kSyncGroup; | 
| 273 | 274 | 
| 274   CreateStreams(); | 275   AudioReceiveStream::Config audio_config; | 
|  | 276   audio_config.voe_channel_id = channel; | 
|  | 277   audio_config.sync_group = kSyncGroup; | 
|  | 278 | 
|  | 279   AudioReceiveStream* audio_receive_stream = nullptr; | 
|  | 280 | 
|  | 281   if (create_audio_first) { | 
|  | 282     audio_receive_stream = | 
|  | 283         receiver_call_->CreateAudioReceiveStream(audio_config); | 
|  | 284     CreateStreams(); | 
|  | 285   } else { | 
|  | 286     CreateStreams(); | 
|  | 287     audio_receive_stream = | 
|  | 288         receiver_call_->CreateAudioReceiveStream(audio_config); | 
|  | 289   } | 
| 275 | 290 | 
| 276   CreateFrameGeneratorCapturer(); | 291   CreateFrameGeneratorCapturer(); | 
| 277 | 292 | 
| 278   Start(); | 293   Start(); | 
| 279 | 294 | 
| 280   fake_audio_device.Start(); | 295   fake_audio_device.Start(); | 
| 281   EXPECT_EQ(0, voe_base->StartPlayout(channel)); | 296   EXPECT_EQ(0, voe_base->StartPlayout(channel)); | 
| 282   EXPECT_EQ(0, voe_base->StartReceive(channel)); | 297   EXPECT_EQ(0, voe_base->StartReceive(channel)); | 
| 283   EXPECT_EQ(0, voe_base->StartSend(channel)); | 298   EXPECT_EQ(0, voe_base->StartSend(channel)); | 
| 284 | 299 | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 295   audio_observer.StopSending(); | 310   audio_observer.StopSending(); | 
| 296 | 311 | 
| 297   voe_base->DeleteChannel(channel); | 312   voe_base->DeleteChannel(channel); | 
| 298   voe_base->Release(); | 313   voe_base->Release(); | 
| 299   voe_codec->Release(); | 314   voe_codec->Release(); | 
| 300   voe_network->Release(); | 315   voe_network->Release(); | 
| 301   voe_sync->Release(); | 316   voe_sync->Release(); | 
| 302 | 317 | 
| 303   DestroyStreams(); | 318   DestroyStreams(); | 
| 304 | 319 | 
|  | 320   receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); | 
|  | 321 | 
| 305   VoiceEngine::Delete(voice_engine); | 322   VoiceEngine::Delete(voice_engine); | 
| 306 } | 323 } | 
| 307 | 324 | 
| 308 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSync) { | 325 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioCreatedFirst) { | 
| 309   TestAudioVideoSync(false); | 326   TestAudioVideoSync(false, true); | 
|  | 327 } | 
|  | 328 | 
|  | 329 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoCreatedFirst) { | 
|  | 330   TestAudioVideoSync(false, false); | 
| 310 } | 331 } | 
| 311 | 332 | 
| 312 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithFec) { | 333 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithFec) { | 
| 313   TestAudioVideoSync(true); | 334   TestAudioVideoSync(true, false); | 
| 314 } | 335 } | 
| 315 | 336 | 
| 316 void CallPerfTest::TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, | 337 void CallPerfTest::TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, | 
| 317                                       int threshold_ms, | 338                                       int threshold_ms, | 
| 318                                       int start_time_ms, | 339                                       int start_time_ms, | 
| 319                                       int run_time_ms) { | 340                                       int run_time_ms) { | 
| 320   class CaptureNtpTimeObserver : public test::EndToEndTest, | 341   class CaptureNtpTimeObserver : public test::EndToEndTest, | 
| 321                                  public VideoRenderer { | 342                                  public VideoRenderer { | 
| 322    public: | 343    public: | 
| 323     CaptureNtpTimeObserver(const FakeNetworkPipe::Config& config, | 344     CaptureNtpTimeObserver(const FakeNetworkPipe::Config& config, | 
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 678     int encoder_inits_; | 699     int encoder_inits_; | 
| 679     uint32_t last_set_bitrate_; | 700     uint32_t last_set_bitrate_; | 
| 680     VideoSendStream* send_stream_; | 701     VideoSendStream* send_stream_; | 
| 681     VideoEncoderConfig encoder_config_; | 702     VideoEncoderConfig encoder_config_; | 
| 682   } test; | 703   } test; | 
| 683 | 704 | 
| 684   RunBaseTest(&test); | 705   RunBaseTest(&test); | 
| 685 } | 706 } | 
| 686 | 707 | 
| 687 }  // namespace webrtc | 708 }  // namespace webrtc | 
| OLD | NEW | 
|---|