| 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 #include <algorithm> |   11 #include <algorithm> | 
 |   12 #include <limits> | 
|   11 #include <memory> |   13 #include <memory> | 
|   12 #include <sstream> |   14 #include <sstream> | 
|   13 #include <string> |   15 #include <string> | 
|   14  |   16  | 
|   15 #include "testing/gtest/include/gtest/gtest.h" |   17 #include "testing/gtest/include/gtest/gtest.h" | 
|   16  |   18  | 
|   17 #include "webrtc/base/checks.h" |   19 #include "webrtc/base/checks.h" | 
|   18 #include "webrtc/base/thread_annotations.h" |   20 #include "webrtc/base/thread_annotations.h" | 
|   19 #include "webrtc/call.h" |   21 #include "webrtc/call.h" | 
|   20 #include "webrtc/call/transport_adapter.h" |   22 #include "webrtc/call/transport_adapter.h" | 
|   21 #include "webrtc/config.h" |   23 #include "webrtc/config.h" | 
|   22 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |   24 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 
|   23 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |   25 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 
|   24 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |   26 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 
|   25 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |   27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 
|   26 #include "webrtc/system_wrappers/include/rtp_to_ntp.h" |   28 #include "webrtc/system_wrappers/include/rtp_to_ntp.h" | 
|   27 #include "webrtc/test/call_test.h" |   29 #include "webrtc/test/call_test.h" | 
|   28 #include "webrtc/test/direct_transport.h" |   30 #include "webrtc/test/direct_transport.h" | 
|   29 #include "webrtc/test/drifting_clock.h" |   31 #include "webrtc/test/drifting_clock.h" | 
|   30 #include "webrtc/test/encoder_settings.h" |   32 #include "webrtc/test/encoder_settings.h" | 
|   31 #include "webrtc/test/fake_audio_device.h" |   33 #include "webrtc/test/fake_audio_device.h" | 
|   32 #include "webrtc/test/fake_decoder.h" |   34 #include "webrtc/test/fake_decoder.h" | 
|   33 #include "webrtc/test/fake_encoder.h" |   35 #include "webrtc/test/fake_encoder.h" | 
|   34 #include "webrtc/test/frame_generator.h" |   36 #include "webrtc/test/frame_generator.h" | 
|   35 #include "webrtc/test/frame_generator_capturer.h" |   37 #include "webrtc/test/frame_generator_capturer.h" | 
 |   38 #include "webrtc/test/histogram.h" | 
|   36 #include "webrtc/test/rtp_rtcp_observer.h" |   39 #include "webrtc/test/rtp_rtcp_observer.h" | 
|   37 #include "webrtc/test/testsupport/fileutils.h" |   40 #include "webrtc/test/testsupport/fileutils.h" | 
|   38 #include "webrtc/test/testsupport/perf_test.h" |   41 #include "webrtc/test/testsupport/perf_test.h" | 
|   39 #include "webrtc/voice_engine/include/voe_base.h" |   42 #include "webrtc/voice_engine/include/voe_base.h" | 
|   40 #include "webrtc/voice_engine/include/voe_codec.h" |   43 #include "webrtc/voice_engine/include/voe_codec.h" | 
|   41 #include "webrtc/voice_engine/include/voe_network.h" |   44 #include "webrtc/voice_engine/include/voe_network.h" | 
|   42 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |   45 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 
|   43 #include "webrtc/voice_engine/include/voe_video_sync.h" |   46 #include "webrtc/voice_engine/include/voe_video_sync.h" | 
|   44  |   47  | 
|   45 using webrtc::test::DriftingClock; |   48 using webrtc::test::DriftingClock; | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|   64   void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms); |   67   void TestCpuOveruse(LoadObserver::Load tested_load, int encode_delay_ms); | 
|   65  |   68  | 
|   66   void TestMinTransmitBitrate(bool pad_to_min_bitrate); |   69   void TestMinTransmitBitrate(bool pad_to_min_bitrate); | 
|   67  |   70  | 
|   68   void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, |   71   void TestCaptureNtpTime(const FakeNetworkPipe::Config& net_config, | 
|   69                           int threshold_ms, |   72                           int threshold_ms, | 
|   70                           int start_time_ms, |   73                           int start_time_ms, | 
|   71                           int run_time_ms); |   74                           int run_time_ms); | 
|   72 }; |   75 }; | 
|   73  |   76  | 
|   74 class SyncRtcpObserver : public test::RtpRtcpObserver { |   77 class VideoRtcpAndSyncObserver : public test::RtpRtcpObserver, | 
|   75  public: |   78                                  public VideoRenderer { | 
|   76   SyncRtcpObserver() : test::RtpRtcpObserver(CallPerfTest::kLongTimeoutMs) {} |  | 
|   77  |  | 
|   78   Action OnSendRtcp(const uint8_t* packet, size_t length) override { |  | 
|   79     RTCPUtility::RTCPParserV2 parser(packet, length, true); |  | 
|   80     EXPECT_TRUE(parser.IsValid()); |  | 
|   81  |  | 
|   82     for (RTCPUtility::RTCPPacketTypes packet_type = parser.Begin(); |  | 
|   83          packet_type != RTCPUtility::RTCPPacketTypes::kInvalid; |  | 
|   84          packet_type = parser.Iterate()) { |  | 
|   85       if (packet_type == RTCPUtility::RTCPPacketTypes::kSr) { |  | 
|   86         const RTCPUtility::RTCPPacket& packet = parser.Packet(); |  | 
|   87         RtcpMeasurement ntp_rtp_pair( |  | 
|   88             packet.SR.NTPMostSignificant, |  | 
|   89             packet.SR.NTPLeastSignificant, |  | 
|   90             packet.SR.RTPTimestamp); |  | 
|   91         StoreNtpRtpPair(ntp_rtp_pair); |  | 
|   92       } |  | 
|   93     } |  | 
|   94     return SEND_PACKET; |  | 
|   95   } |  | 
|   96  |  | 
|   97   int64_t RtpTimestampToNtp(uint32_t timestamp) const { |  | 
|   98     rtc::CritScope lock(&crit_); |  | 
|   99     int64_t timestamp_in_ms = -1; |  | 
|  100     if (ntp_rtp_pairs_.size() == 2) { |  | 
|  101       // TODO(stefan): We can't EXPECT_TRUE on this call due to a bug in the |  | 
|  102       // RTCP sender where it sends RTCP SR before any RTP packets, which leads |  | 
|  103       // to a bogus NTP/RTP mapping. |  | 
|  104       RtpToNtpMs(timestamp, ntp_rtp_pairs_, ×tamp_in_ms); |  | 
|  105       return timestamp_in_ms; |  | 
|  106     } |  | 
|  107     return -1; |  | 
|  108   } |  | 
|  109  |  | 
|  110  private: |  | 
|  111   void StoreNtpRtpPair(RtcpMeasurement ntp_rtp_pair) { |  | 
|  112     rtc::CritScope lock(&crit_); |  | 
|  113     for (RtcpList::iterator it = ntp_rtp_pairs_.begin(); |  | 
|  114          it != ntp_rtp_pairs_.end(); |  | 
|  115          ++it) { |  | 
|  116       if (ntp_rtp_pair.ntp_secs == it->ntp_secs && |  | 
|  117           ntp_rtp_pair.ntp_frac == it->ntp_frac) { |  | 
|  118         // This RTCP has already been added to the list. |  | 
|  119         return; |  | 
|  120       } |  | 
|  121     } |  | 
|  122     // We need two RTCP SR reports to map between RTP and NTP. More than two |  | 
|  123     // will not improve the mapping. |  | 
|  124     if (ntp_rtp_pairs_.size() == 2) { |  | 
|  125       ntp_rtp_pairs_.pop_back(); |  | 
|  126     } |  | 
|  127     ntp_rtp_pairs_.push_front(ntp_rtp_pair); |  | 
|  128   } |  | 
|  129  |  | 
|  130   rtc::CriticalSection crit_; |  | 
|  131   RtcpList ntp_rtp_pairs_ GUARDED_BY(crit_); |  | 
|  132 }; |  | 
|  133  |  | 
|  134 class VideoRtcpAndSyncObserver : public SyncRtcpObserver, public VideoRenderer { |  | 
|  135   static const int kInSyncThresholdMs = 50; |   79   static const int kInSyncThresholdMs = 50; | 
|  136   static const int kStartupTimeMs = 2000; |   80   static const int kStartupTimeMs = 2000; | 
|  137   static const int kMinRunTimeMs = 30000; |   81   static const int kMinRunTimeMs = 30000; | 
|  138  |   82  | 
|  139  public: |   83  public: | 
|  140   VideoRtcpAndSyncObserver(Clock* clock, |   84   explicit VideoRtcpAndSyncObserver(Clock* clock) | 
|  141                            int voe_channel, |   85       : test::RtpRtcpObserver(CallPerfTest::kLongTimeoutMs), | 
|  142                            VoEVideoSync* voe_sync, |   86         clock_(clock), | 
|  143                            SyncRtcpObserver* audio_observer) |  | 
|  144       : clock_(clock), |  | 
|  145         voe_channel_(voe_channel), |  | 
|  146         voe_sync_(voe_sync), |  | 
|  147         audio_observer_(audio_observer), |  | 
|  148         creation_time_ms_(clock_->TimeInMilliseconds()), |   87         creation_time_ms_(clock_->TimeInMilliseconds()), | 
|  149         first_time_in_sync_(-1) {} |   88         first_time_in_sync_(-1), | 
 |   89         receive_stream_(nullptr) {} | 
|  150  |   90  | 
|  151   void RenderFrame(const VideoFrame& video_frame, |   91   void RenderFrame(const VideoFrame& video_frame, | 
|  152                    int time_to_render_ms) override { |   92                    int time_to_render_ms) override { | 
 |   93     VideoReceiveStream::Stats stats; | 
 |   94     { | 
 |   95       rtc::CritScope lock(&crit_); | 
 |   96       if (receive_stream_) | 
 |   97         stats = receive_stream_->GetStats(); | 
 |   98     } | 
 |   99     if (stats.sync_offset_ms == std::numeric_limits<int>::max()) | 
 |  100       return; | 
 |  101  | 
|  153     int64_t now_ms = clock_->TimeInMilliseconds(); |  102     int64_t now_ms = clock_->TimeInMilliseconds(); | 
|  154     uint32_t playout_timestamp = 0; |  103  | 
|  155     if (voe_sync_->GetPlayoutTimestamp(voe_channel_, playout_timestamp) != 0) |  | 
|  156       return; |  | 
|  157     int64_t latest_audio_ntp = |  | 
|  158         audio_observer_->RtpTimestampToNtp(playout_timestamp); |  | 
|  159     int64_t latest_video_ntp = RtpTimestampToNtp(video_frame.timestamp()); |  | 
|  160     if (latest_audio_ntp < 0 || latest_video_ntp < 0) |  | 
|  161       return; |  | 
|  162     int time_until_render_ms = |  | 
|  163         std::max(0, static_cast<int>(video_frame.render_time_ms() - now_ms)); |  | 
|  164     latest_video_ntp += time_until_render_ms; |  | 
|  165     int64_t stream_offset = latest_audio_ntp - latest_video_ntp; |  | 
|  166     std::stringstream ss; |  104     std::stringstream ss; | 
|  167     ss << stream_offset; |  105     ss << stats.sync_offset_ms; | 
|  168     webrtc::test::PrintResult("stream_offset", |  106     webrtc::test::PrintResult("stream_offset", | 
|  169                               "", |  107                               "", | 
|  170                               "synchronization", |  108                               "synchronization", | 
|  171                               ss.str(), |  109                               ss.str(), | 
|  172                               "ms", |  110                               "ms", | 
|  173                               false); |  111                               false); | 
|  174     int64_t time_since_creation = now_ms - creation_time_ms_; |  112     int64_t time_since_creation = now_ms - creation_time_ms_; | 
|  175     // During the first couple of seconds audio and video can falsely be |  113     // During the first couple of seconds audio and video can falsely be | 
|  176     // estimated as being synchronized. We don't want to trigger on those. |  114     // estimated as being synchronized. We don't want to trigger on those. | 
|  177     if (time_since_creation < kStartupTimeMs) |  115     if (time_since_creation < kStartupTimeMs) | 
|  178       return; |  116       return; | 
|  179     if (std::abs(latest_audio_ntp - latest_video_ntp) < kInSyncThresholdMs) { |  117     if (std::abs(stats.sync_offset_ms) < kInSyncThresholdMs) { | 
|  180       if (first_time_in_sync_ == -1) { |  118       if (first_time_in_sync_ == -1) { | 
|  181         first_time_in_sync_ = now_ms; |  119         first_time_in_sync_ = now_ms; | 
|  182         webrtc::test::PrintResult("sync_convergence_time", |  120         webrtc::test::PrintResult("sync_convergence_time", | 
|  183                                   "", |  121                                   "", | 
|  184                                   "synchronization", |  122                                   "synchronization", | 
|  185                                   time_since_creation, |  123                                   time_since_creation, | 
|  186                                   "ms", |  124                                   "ms", | 
|  187                                   false); |  125                                   false); | 
|  188       } |  126       } | 
|  189       if (time_since_creation > kMinRunTimeMs) |  127       if (time_since_creation > kMinRunTimeMs) | 
|  190         observation_complete_.Set(); |  128         observation_complete_.Set(); | 
|  191     } |  129     } | 
|  192   } |  130   } | 
|  193  |  131  | 
|  194   bool IsTextureSupported() const override { return false; } |  132   bool IsTextureSupported() const override { return false; } | 
|  195  |  133  | 
 |  134   void set_receive_stream(VideoReceiveStream* receive_stream) { | 
 |  135     rtc::CritScope lock(&crit_); | 
 |  136     receive_stream_ = receive_stream; | 
 |  137   } | 
 |  138  | 
|  196  private: |  139  private: | 
|  197   Clock* const clock_; |  140   Clock* const clock_; | 
|  198   const int voe_channel_; |  | 
|  199   VoEVideoSync* const voe_sync_; |  | 
|  200   SyncRtcpObserver* const audio_observer_; |  | 
|  201   const int64_t creation_time_ms_; |  141   const int64_t creation_time_ms_; | 
|  202   int64_t first_time_in_sync_; |  142   int64_t first_time_in_sync_; | 
 |  143   rtc::CriticalSection crit_; | 
 |  144   VideoReceiveStream* receive_stream_ GUARDED_BY(crit_); | 
|  203 }; |  145 }; | 
|  204  |  146  | 
|  205 void CallPerfTest::TestAudioVideoSync(FecMode fec, |  147 void CallPerfTest::TestAudioVideoSync(FecMode fec, | 
|  206                                       CreateOrder create_first, |  148                                       CreateOrder create_first, | 
|  207                                       float video_ntp_speed, |  149                                       float video_ntp_speed, | 
|  208                                       float video_rtp_speed, |  150                                       float video_rtp_speed, | 
|  209                                       float audio_rtp_speed) { |  151                                       float audio_rtp_speed) { | 
|  210   const char* kSyncGroup = "av_sync"; |  152   const char* kSyncGroup = "av_sync"; | 
|  211   const uint32_t kAudioSendSsrc = 1234; |  153   const uint32_t kAudioSendSsrc = 1234; | 
|  212   const uint32_t kAudioRecvSsrc = 5678; |  154   const uint32_t kAudioRecvSsrc = 5678; | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  231       } |  173       } | 
|  232       return ret == 0 ? DELIVERY_OK : DELIVERY_PACKET_ERROR; |  174       return ret == 0 ? DELIVERY_OK : DELIVERY_PACKET_ERROR; | 
|  233     } |  175     } | 
|  234  |  176  | 
|  235    private: |  177    private: | 
|  236     int channel_; |  178     int channel_; | 
|  237     VoENetwork* voe_network_; |  179     VoENetwork* voe_network_; | 
|  238     std::unique_ptr<RtpHeaderParser> parser_; |  180     std::unique_ptr<RtpHeaderParser> parser_; | 
|  239   }; |  181   }; | 
|  240  |  182  | 
 |  183   test::ClearHistograms(); | 
|  241   VoiceEngine* voice_engine = VoiceEngine::Create(); |  184   VoiceEngine* voice_engine = VoiceEngine::Create(); | 
|  242   VoEBase* voe_base = VoEBase::GetInterface(voice_engine); |  185   VoEBase* voe_base = VoEBase::GetInterface(voice_engine); | 
|  243   VoECodec* voe_codec = VoECodec::GetInterface(voice_engine); |  186   VoECodec* voe_codec = VoECodec::GetInterface(voice_engine); | 
|  244   VoENetwork* voe_network = VoENetwork::GetInterface(voice_engine); |  187   VoENetwork* voe_network = VoENetwork::GetInterface(voice_engine); | 
|  245   VoEVideoSync* voe_sync = VoEVideoSync::GetInterface(voice_engine); |  | 
|  246   const std::string audio_filename = |  188   const std::string audio_filename = | 
|  247       test::ResourcePath("voice_engine/audio_long16", "pcm"); |  189       test::ResourcePath("voice_engine/audio_long16", "pcm"); | 
|  248   ASSERT_STRNE("", audio_filename.c_str()); |  190   ASSERT_STRNE("", audio_filename.c_str()); | 
|  249   FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, |  191   FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename, | 
|  250                                     audio_rtp_speed); |  192                                     audio_rtp_speed); | 
|  251   EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr)); |  193   EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr)); | 
|  252   Config voe_config; |  194   Config voe_config; | 
|  253   voe_config.Set<VoicePacing>(new VoicePacing(true)); |  195   voe_config.Set<VoicePacing>(new VoicePacing(true)); | 
|  254   int send_channel_id = voe_base->CreateChannel(voe_config); |  196   int send_channel_id = voe_base->CreateChannel(voe_config); | 
|  255   int recv_channel_id = voe_base->CreateChannel(); |  197   int recv_channel_id = voe_base->CreateChannel(); | 
|  256  |  198  | 
|  257   SyncRtcpObserver audio_observer; |  | 
|  258  |  | 
|  259   AudioState::Config send_audio_state_config; |  199   AudioState::Config send_audio_state_config; | 
|  260   send_audio_state_config.voice_engine = voice_engine; |  200   send_audio_state_config.voice_engine = voice_engine; | 
|  261   Call::Config sender_config; |  201   Call::Config sender_config; | 
|  262   sender_config.audio_state = AudioState::Create(send_audio_state_config); |  202   sender_config.audio_state = AudioState::Create(send_audio_state_config); | 
|  263   Call::Config receiver_config; |  203   Call::Config receiver_config; | 
|  264   receiver_config.audio_state = sender_config.audio_state; |  204   receiver_config.audio_state = sender_config.audio_state; | 
|  265   CreateCalls(sender_config, receiver_config); |  205   CreateCalls(sender_config, receiver_config); | 
|  266  |  206  | 
|  267   AudioPacketReceiver voe_send_packet_receiver(send_channel_id, voe_network); |  207   AudioPacketReceiver voe_send_packet_receiver(send_channel_id, voe_network); | 
|  268   AudioPacketReceiver voe_recv_packet_receiver(recv_channel_id, voe_network); |  208   AudioPacketReceiver voe_recv_packet_receiver(recv_channel_id, voe_network); | 
|  269  |  209  | 
 |  210   VideoRtcpAndSyncObserver observer(Clock::GetRealTimeClock()); | 
 |  211  | 
|  270   FakeNetworkPipe::Config net_config; |  212   FakeNetworkPipe::Config net_config; | 
|  271   net_config.queue_delay_ms = 500; |  213   net_config.queue_delay_ms = 500; | 
|  272   net_config.loss_percent = 5; |  214   net_config.loss_percent = 5; | 
|  273   test::PacketTransport audio_send_transport( |  215   test::PacketTransport audio_send_transport( | 
|  274       nullptr, &audio_observer, test::PacketTransport::kSender, net_config); |  216       nullptr, &observer, test::PacketTransport::kSender, net_config); | 
|  275   audio_send_transport.SetReceiver(&voe_recv_packet_receiver); |  217   audio_send_transport.SetReceiver(&voe_recv_packet_receiver); | 
|  276   test::PacketTransport audio_receive_transport( |  218   test::PacketTransport audio_receive_transport( | 
|  277       nullptr, &audio_observer, test::PacketTransport::kReceiver, net_config); |  219       nullptr, &observer, test::PacketTransport::kReceiver, net_config); | 
|  278   audio_receive_transport.SetReceiver(&voe_send_packet_receiver); |  220   audio_receive_transport.SetReceiver(&voe_send_packet_receiver); | 
|  279  |  221  | 
|  280   internal::TransportAdapter send_transport_adapter(&audio_send_transport); |  222   internal::TransportAdapter send_transport_adapter(&audio_send_transport); | 
|  281   send_transport_adapter.Enable(); |  223   send_transport_adapter.Enable(); | 
|  282   EXPECT_EQ(0, voe_network->RegisterExternalTransport(send_channel_id, |  224   EXPECT_EQ(0, voe_network->RegisterExternalTransport(send_channel_id, | 
|  283                                                       send_transport_adapter)); |  225                                                       send_transport_adapter)); | 
|  284  |  226  | 
|  285   internal::TransportAdapter recv_transport_adapter(&audio_receive_transport); |  227   internal::TransportAdapter recv_transport_adapter(&audio_receive_transport); | 
|  286   recv_transport_adapter.Enable(); |  228   recv_transport_adapter.Enable(); | 
|  287   EXPECT_EQ(0, voe_network->RegisterExternalTransport(recv_channel_id, |  229   EXPECT_EQ(0, voe_network->RegisterExternalTransport(recv_channel_id, | 
|  288                                                       recv_transport_adapter)); |  230                                                       recv_transport_adapter)); | 
|  289  |  231  | 
|  290   VideoRtcpAndSyncObserver observer(Clock::GetRealTimeClock(), recv_channel_id, |  | 
|  291                                     voe_sync, &audio_observer); |  | 
|  292  |  | 
|  293   test::PacketTransport sync_send_transport(sender_call_.get(), &observer, |  232   test::PacketTransport sync_send_transport(sender_call_.get(), &observer, | 
|  294                                             test::PacketTransport::kSender, |  233                                             test::PacketTransport::kSender, | 
|  295                                             FakeNetworkPipe::Config()); |  234                                             FakeNetworkPipe::Config()); | 
|  296   sync_send_transport.SetReceiver(receiver_call_->Receiver()); |  235   sync_send_transport.SetReceiver(receiver_call_->Receiver()); | 
|  297   test::PacketTransport sync_receive_transport(receiver_call_.get(), &observer, |  236   test::PacketTransport sync_receive_transport(receiver_call_.get(), &observer, | 
|  298                                                test::PacketTransport::kReceiver, |  237                                                test::PacketTransport::kReceiver, | 
|  299                                                FakeNetworkPipe::Config()); |  238                                                FakeNetworkPipe::Config()); | 
|  300   sync_receive_transport.SetReceiver(sender_call_->Receiver()); |  239   sync_receive_transport.SetReceiver(sender_call_->Receiver()); | 
|  301  |  240  | 
|  302   test::FakeDecoder fake_decoder; |  241   test::FakeDecoder fake_decoder; | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  334  |  273  | 
|  335   if (create_first == CreateOrder::kAudioFirst) { |  274   if (create_first == CreateOrder::kAudioFirst) { | 
|  336     audio_receive_stream = |  275     audio_receive_stream = | 
|  337         receiver_call_->CreateAudioReceiveStream(audio_recv_config); |  276         receiver_call_->CreateAudioReceiveStream(audio_recv_config); | 
|  338     CreateVideoStreams(); |  277     CreateVideoStreams(); | 
|  339   } else { |  278   } else { | 
|  340     CreateVideoStreams(); |  279     CreateVideoStreams(); | 
|  341     audio_receive_stream = |  280     audio_receive_stream = | 
|  342         receiver_call_->CreateAudioReceiveStream(audio_recv_config); |  281         receiver_call_->CreateAudioReceiveStream(audio_recv_config); | 
|  343   } |  282   } | 
|  344  |  283   EXPECT_EQ(1u, video_receive_streams_.size()); | 
 |  284   observer.set_receive_stream(video_receive_streams_[0]); | 
|  345   DriftingClock drifting_clock(clock_, video_ntp_speed); |  285   DriftingClock drifting_clock(clock_, video_ntp_speed); | 
|  346   CreateFrameGeneratorCapturerWithDrift(&drifting_clock, video_rtp_speed); |  286   CreateFrameGeneratorCapturerWithDrift(&drifting_clock, video_rtp_speed); | 
|  347  |  287  | 
|  348   Start(); |  288   Start(); | 
|  349  |  289  | 
|  350   fake_audio_device.Start(); |  290   fake_audio_device.Start(); | 
|  351   EXPECT_EQ(0, voe_base->StartPlayout(recv_channel_id)); |  291   EXPECT_EQ(0, voe_base->StartPlayout(recv_channel_id)); | 
|  352   EXPECT_EQ(0, voe_base->StartReceive(recv_channel_id)); |  292   EXPECT_EQ(0, voe_base->StartReceive(recv_channel_id)); | 
|  353   EXPECT_EQ(0, voe_base->StartSend(send_channel_id)); |  293   EXPECT_EQ(0, voe_base->StartSend(send_channel_id)); | 
|  354  |  294  | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  369   DestroyStreams(); |  309   DestroyStreams(); | 
|  370  |  310  | 
|  371   sender_call_->DestroyAudioSendStream(audio_send_stream); |  311   sender_call_->DestroyAudioSendStream(audio_send_stream); | 
|  372   receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); |  312   receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); | 
|  373  |  313  | 
|  374   voe_base->DeleteChannel(send_channel_id); |  314   voe_base->DeleteChannel(send_channel_id); | 
|  375   voe_base->DeleteChannel(recv_channel_id); |  315   voe_base->DeleteChannel(recv_channel_id); | 
|  376   voe_base->Release(); |  316   voe_base->Release(); | 
|  377   voe_codec->Release(); |  317   voe_codec->Release(); | 
|  378   voe_network->Release(); |  318   voe_network->Release(); | 
|  379   voe_sync->Release(); |  | 
|  380  |  319  | 
|  381   DestroyCalls(); |  320   DestroyCalls(); | 
|  382  |  321  | 
|  383   VoiceEngine::Delete(voice_engine); |  322   VoiceEngine::Delete(voice_engine); | 
 |  323  | 
 |  324   EXPECT_EQ(1, test::NumHistogramSamples("WebRTC.Video.AVSyncOffsetInMs")); | 
|  384 } |  325 } | 
|  385  |  326  | 
|  386 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { |  327 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithVideoNtpDrift) { | 
|  387   TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |  328   TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, | 
|  388                      DriftingClock::PercentsFaster(10.0f), |  329                      DriftingClock::PercentsFaster(10.0f), | 
|  389                      DriftingClock::kNoDrift, DriftingClock::kNoDrift); |  330                      DriftingClock::kNoDrift, DriftingClock::kNoDrift); | 
|  390 } |  331 } | 
|  391  |  332  | 
|  392 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) { |  333 TEST_F(CallPerfTest, PlaysOutAudioAndVideoInSyncWithAudioFasterThanVideoDrift) { | 
|  393   TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, |  334   TestAudioVideoSync(FecMode::kOff, CreateOrder::kAudioFirst, | 
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  776     int encoder_inits_; |  717     int encoder_inits_; | 
|  777     uint32_t last_set_bitrate_; |  718     uint32_t last_set_bitrate_; | 
|  778     VideoSendStream* send_stream_; |  719     VideoSendStream* send_stream_; | 
|  779     VideoEncoderConfig encoder_config_; |  720     VideoEncoderConfig encoder_config_; | 
|  780   } test; |  721   } test; | 
|  781  |  722  | 
|  782   RunBaseTest(&test); |  723   RunBaseTest(&test); | 
|  783 } |  724 } | 
|  784  |  725  | 
|  785 }  // namespace webrtc |  726 }  // namespace webrtc | 
| OLD | NEW |