| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 14 matching lines...) Expand all Loading... |
| 25 #include "webrtc/base/fakeclock.h" | 25 #include "webrtc/base/fakeclock.h" |
| 26 #include "webrtc/base/fakesslidentity.h" | 26 #include "webrtc/base/fakesslidentity.h" |
| 27 #include "webrtc/base/gunit.h" | 27 #include "webrtc/base/gunit.h" |
| 28 #include "webrtc/base/logging.h" | 28 #include "webrtc/base/logging.h" |
| 29 #include "webrtc/base/socketaddress.h" | 29 #include "webrtc/base/socketaddress.h" |
| 30 #include "webrtc/base/thread_checker.h" | 30 #include "webrtc/base/thread_checker.h" |
| 31 #include "webrtc/base/timedelta.h" | 31 #include "webrtc/base/timedelta.h" |
| 32 #include "webrtc/base/timeutils.h" | 32 #include "webrtc/base/timeutils.h" |
| 33 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 33 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 34 #include "webrtc/media/base/fakemediaengine.h" | 34 #include "webrtc/media/base/fakemediaengine.h" |
| 35 #include "webrtc/media/base/test/mock_mediachannel.h" | |
| 36 #include "webrtc/p2p/base/p2pconstants.h" | 35 #include "webrtc/p2p/base/p2pconstants.h" |
| 37 #include "webrtc/p2p/base/port.h" | 36 #include "webrtc/p2p/base/port.h" |
| 38 | 37 |
| 39 using testing::_; | 38 using testing::_; |
| 40 using testing::Invoke; | 39 using testing::Invoke; |
| 41 using testing::Return; | 40 using testing::Return; |
| 42 using testing::ReturnNull; | |
| 43 using testing::ReturnRef; | 41 using testing::ReturnRef; |
| 44 using testing::SetArgPointee; | |
| 45 | 42 |
| 46 namespace webrtc { | 43 namespace webrtc { |
| 47 | 44 |
| 48 // These are used by gtest code, such as if |EXPECT_EQ| fails. | 45 // These are used by gtest code, such as if |EXPECT_EQ| fails. |
| 49 void PrintTo(const RTCCertificateStats& stats, ::std::ostream* os) { | 46 void PrintTo(const RTCCertificateStats& stats, ::std::ostream* os) { |
| 50 *os << stats.ToString(); | 47 *os << stats.ToString(); |
| 51 } | 48 } |
| 52 | 49 |
| 53 void PrintTo(const RTCDataChannelStats& stats, ::std::ostream* os) { | 50 void PrintTo(const RTCDataChannelStats& stats, ::std::ostream* os) { |
| 54 *os << stats.ToString(); | 51 *os << stats.ToString(); |
| 55 } | 52 } |
| 56 | 53 |
| 57 void PrintTo(const RTCIceCandidatePairStats& stats, ::std::ostream* os) { | 54 void PrintTo(const RTCIceCandidatePairStats& stats, ::std::ostream* os) { |
| 58 *os << stats.ToString(); | 55 *os << stats.ToString(); |
| 59 } | 56 } |
| 60 | 57 |
| 61 void PrintTo(const RTCLocalIceCandidateStats& stats, ::std::ostream* os) { | 58 void PrintTo(const RTCLocalIceCandidateStats& stats, ::std::ostream* os) { |
| 62 *os << stats.ToString(); | 59 *os << stats.ToString(); |
| 63 } | 60 } |
| 64 | 61 |
| 65 void PrintTo(const RTCRemoteIceCandidateStats& stats, ::std::ostream* os) { | 62 void PrintTo(const RTCRemoteIceCandidateStats& stats, ::std::ostream* os) { |
| 66 *os << stats.ToString(); | 63 *os << stats.ToString(); |
| 67 } | 64 } |
| 68 | 65 |
| 69 void PrintTo(const RTCPeerConnectionStats& stats, ::std::ostream* os) { | 66 void PrintTo(const RTCPeerConnectionStats& stats, ::std::ostream* os) { |
| 70 *os << stats.ToString(); | 67 *os << stats.ToString(); |
| 71 } | 68 } |
| 72 | 69 |
| 73 void PrintTo(const RTCOutboundRTPStreamStats& stats, ::std::ostream* os) { | |
| 74 *os << stats.ToString(); | |
| 75 } | |
| 76 | |
| 77 void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) { | 70 void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) { |
| 78 *os << stats.ToString(); | 71 *os << stats.ToString(); |
| 79 } | 72 } |
| 80 | 73 |
| 81 namespace { | 74 namespace { |
| 82 | 75 |
| 83 const int64_t kGetStatsReportTimeoutMs = 1000; | 76 const int64_t kGetStatsReportTimeoutMs = 1000; |
| 84 | 77 |
| 85 struct CertificateInfo { | 78 struct CertificateInfo { |
| 86 rtc::scoped_refptr<rtc::RTCCertificate> certificate; | 79 rtc::scoped_refptr<rtc::RTCCertificate> certificate; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 candidate->set_type(candidate_type); | 137 candidate->set_type(candidate_type); |
| 145 candidate->set_priority(priority); | 138 candidate->set_priority(priority); |
| 146 return candidate; | 139 return candidate; |
| 147 } | 140 } |
| 148 | 141 |
| 149 class RTCStatsCollectorTestHelper : public SetSessionDescriptionObserver { | 142 class RTCStatsCollectorTestHelper : public SetSessionDescriptionObserver { |
| 150 public: | 143 public: |
| 151 RTCStatsCollectorTestHelper() | 144 RTCStatsCollectorTestHelper() |
| 152 : worker_thread_(rtc::Thread::Current()), | 145 : worker_thread_(rtc::Thread::Current()), |
| 153 network_thread_(rtc::Thread::Current()), | 146 network_thread_(rtc::Thread::Current()), |
| 154 media_engine_(new cricket::FakeMediaEngine()), | |
| 155 channel_manager_( | 147 channel_manager_( |
| 156 new cricket::ChannelManager(media_engine_, | 148 new cricket::ChannelManager(new cricket::FakeMediaEngine(), |
| 157 worker_thread_, | 149 worker_thread_, |
| 158 network_thread_)), | 150 network_thread_)), |
| 159 media_controller_( | 151 media_controller_( |
| 160 MediaControllerInterface::Create(cricket::MediaConfig(), | 152 MediaControllerInterface::Create(cricket::MediaConfig(), |
| 161 worker_thread_, | 153 worker_thread_, |
| 162 channel_manager_.get(), | 154 channel_manager_.get(), |
| 163 &event_log_)), | 155 &event_log_)), |
| 164 session_(media_controller_.get()), | 156 session_(media_controller_.get()), |
| 165 pc_() { | 157 pc_() { |
| 166 // Default return values for mocks. | 158 // Default return values for mocks. |
| 167 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); | 159 EXPECT_CALL(pc_, session()).WillRepeatedly(Return(&session_)); |
| 168 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( | 160 EXPECT_CALL(pc_, sctp_data_channels()).WillRepeatedly( |
| 169 ReturnRef(data_channels_)); | 161 ReturnRef(data_channels_)); |
| 170 EXPECT_CALL(session_, video_channel()).WillRepeatedly(ReturnNull()); | |
| 171 EXPECT_CALL(session_, voice_channel()).WillRepeatedly(ReturnNull()); | |
| 172 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); | 162 EXPECT_CALL(session_, GetTransportStats(_)).WillRepeatedly(Return(false)); |
| 173 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( | 163 EXPECT_CALL(session_, GetLocalCertificate(_, _)).WillRepeatedly( |
| 174 Return(false)); | 164 Return(false)); |
| 175 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) | 165 EXPECT_CALL(session_, GetRemoteSSLCertificate_ReturnsRawPointer(_)) |
| 176 .WillRepeatedly(Return(nullptr)); | 166 .WillRepeatedly(Return(nullptr)); |
| 177 } | 167 } |
| 178 | 168 |
| 179 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; } | 169 rtc::ScopedFakeClock& fake_clock() { return fake_clock_; } |
| 180 rtc::Thread* worker_thread() { return worker_thread_; } | |
| 181 rtc::Thread* network_thread() { return network_thread_; } | |
| 182 cricket::FakeMediaEngine* media_engine() { return media_engine_; } | |
| 183 MockWebRtcSession& session() { return session_; } | 170 MockWebRtcSession& session() { return session_; } |
| 184 MockPeerConnection& pc() { return pc_; } | 171 MockPeerConnection& pc() { return pc_; } |
| 185 std::vector<rtc::scoped_refptr<DataChannel>>& data_channels() { | 172 std::vector<rtc::scoped_refptr<DataChannel>>& data_channels() { |
| 186 return data_channels_; | 173 return data_channels_; |
| 187 } | 174 } |
| 188 | 175 |
| 189 // SetSessionDescriptionObserver overrides. | 176 // SetSessionDescriptionObserver overrides. |
| 190 void OnSuccess() override {} | 177 void OnSuccess() override {} |
| 191 void OnFailure(const std::string& error) override { | 178 void OnFailure(const std::string& error) override { |
| 192 RTC_NOTREACHED() << error; | 179 RTC_NOTREACHED() << error; |
| 193 } | 180 } |
| 194 | 181 |
| 195 private: | 182 private: |
| 196 rtc::ScopedFakeClock fake_clock_; | 183 rtc::ScopedFakeClock fake_clock_; |
| 197 webrtc::RtcEventLogNullImpl event_log_; | 184 webrtc::RtcEventLogNullImpl event_log_; |
| 198 rtc::Thread* const worker_thread_; | 185 rtc::Thread* const worker_thread_; |
| 199 rtc::Thread* const network_thread_; | 186 rtc::Thread* const network_thread_; |
| 200 cricket::FakeMediaEngine* media_engine_; | |
| 201 std::unique_ptr<cricket::ChannelManager> channel_manager_; | 187 std::unique_ptr<cricket::ChannelManager> channel_manager_; |
| 202 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; | 188 std::unique_ptr<webrtc::MediaControllerInterface> media_controller_; |
| 203 MockWebRtcSession session_; | 189 MockWebRtcSession session_; |
| 204 MockPeerConnection pc_; | 190 MockPeerConnection pc_; |
| 205 | 191 |
| 206 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; | 192 std::vector<rtc::scoped_refptr<DataChannel>> data_channels_; |
| 207 }; | 193 }; |
| 208 | 194 |
| 209 class RTCTestStats : public RTCStats { | 195 class RTCTestStats : public RTCStats { |
| 210 public: | 196 public: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 264 |
| 279 void ProducePartialResultsOnSignalingThread(int64_t timestamp_us) override { | 265 void ProducePartialResultsOnSignalingThread(int64_t timestamp_us) override { |
| 280 EXPECT_TRUE(signaling_thread_->IsCurrent()); | 266 EXPECT_TRUE(signaling_thread_->IsCurrent()); |
| 281 { | 267 { |
| 282 rtc::CritScope cs(&lock_); | 268 rtc::CritScope cs(&lock_); |
| 283 EXPECT_FALSE(delivered_report_); | 269 EXPECT_FALSE(delivered_report_); |
| 284 ++produced_on_signaling_thread_; | 270 ++produced_on_signaling_thread_; |
| 285 } | 271 } |
| 286 | 272 |
| 287 rtc::scoped_refptr<RTCStatsReport> signaling_report = | 273 rtc::scoped_refptr<RTCStatsReport> signaling_report = |
| 288 RTCStatsReport::Create(0); | 274 RTCStatsReport::Create(); |
| 289 signaling_report->AddStats(std::unique_ptr<const RTCStats>( | 275 signaling_report->AddStats(std::unique_ptr<const RTCStats>( |
| 290 new RTCTestStats("SignalingThreadStats", timestamp_us))); | 276 new RTCTestStats("SignalingThreadStats", timestamp_us))); |
| 291 AddPartialResults(signaling_report); | 277 AddPartialResults(signaling_report); |
| 292 } | 278 } |
| 293 void ProducePartialResultsOnWorkerThread(int64_t timestamp_us) override { | 279 void ProducePartialResultsOnWorkerThread(int64_t timestamp_us) override { |
| 294 EXPECT_TRUE(worker_thread_->IsCurrent()); | 280 EXPECT_TRUE(worker_thread_->IsCurrent()); |
| 295 { | 281 { |
| 296 rtc::CritScope cs(&lock_); | 282 rtc::CritScope cs(&lock_); |
| 297 EXPECT_FALSE(delivered_report_); | 283 EXPECT_FALSE(delivered_report_); |
| 298 ++produced_on_worker_thread_; | 284 ++produced_on_worker_thread_; |
| 299 } | 285 } |
| 300 | 286 |
| 301 rtc::scoped_refptr<RTCStatsReport> worker_report = | 287 rtc::scoped_refptr<RTCStatsReport> worker_report = RTCStatsReport::Create(); |
| 302 RTCStatsReport::Create(0); | |
| 303 worker_report->AddStats(std::unique_ptr<const RTCStats>( | 288 worker_report->AddStats(std::unique_ptr<const RTCStats>( |
| 304 new RTCTestStats("WorkerThreadStats", timestamp_us))); | 289 new RTCTestStats("WorkerThreadStats", timestamp_us))); |
| 305 AddPartialResults(worker_report); | 290 AddPartialResults(worker_report); |
| 306 } | 291 } |
| 307 void ProducePartialResultsOnNetworkThread(int64_t timestamp_us) override { | 292 void ProducePartialResultsOnNetworkThread(int64_t timestamp_us) override { |
| 308 EXPECT_TRUE(network_thread_->IsCurrent()); | 293 EXPECT_TRUE(network_thread_->IsCurrent()); |
| 309 { | 294 { |
| 310 rtc::CritScope cs(&lock_); | 295 rtc::CritScope cs(&lock_); |
| 311 EXPECT_FALSE(delivered_report_); | 296 EXPECT_FALSE(delivered_report_); |
| 312 ++produced_on_network_thread_; | 297 ++produced_on_network_thread_; |
| 313 } | 298 } |
| 314 | 299 |
| 315 rtc::scoped_refptr<RTCStatsReport> network_report = | 300 rtc::scoped_refptr<RTCStatsReport> network_report = |
| 316 RTCStatsReport::Create(0); | 301 RTCStatsReport::Create(); |
| 317 network_report->AddStats(std::unique_ptr<const RTCStats>( | 302 network_report->AddStats(std::unique_ptr<const RTCStats>( |
| 318 new RTCTestStats("NetworkThreadStats", timestamp_us))); | 303 new RTCTestStats("NetworkThreadStats", timestamp_us))); |
| 319 AddPartialResults(network_report); | 304 AddPartialResults(network_report); |
| 320 } | 305 } |
| 321 | 306 |
| 322 private: | 307 private: |
| 323 rtc::Thread* const signaling_thread_; | 308 rtc::Thread* const signaling_thread_; |
| 324 rtc::Thread* const worker_thread_; | 309 rtc::Thread* const worker_thread_; |
| 325 rtc::Thread* const network_thread_; | 310 rtc::Thread* const network_thread_; |
| 326 | 311 |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 // channels that have been opened and closed, not the numbers currently | 953 // channels that have been opened and closed, not the numbers currently |
| 969 // open/closed, we would expect opened >= closed and (opened - closed) to be | 954 // open/closed, we would expect opened >= closed and (opened - closed) to be |
| 970 // the number currently open. crbug.com/636818. | 955 // the number currently open. crbug.com/636818. |
| 971 const RTCPeerConnectionStats& pcstats = | 956 const RTCPeerConnectionStats& pcstats = |
| 972 stats->cast_to<RTCPeerConnectionStats>(); | 957 stats->cast_to<RTCPeerConnectionStats>(); |
| 973 EXPECT_EQ(*pcstats.data_channels_opened, static_cast<uint32_t>(1)); | 958 EXPECT_EQ(*pcstats.data_channels_opened, static_cast<uint32_t>(1)); |
| 974 EXPECT_EQ(*pcstats.data_channels_closed, static_cast<uint32_t>(3)); | 959 EXPECT_EQ(*pcstats.data_channels_closed, static_cast<uint32_t>(3)); |
| 975 } | 960 } |
| 976 } | 961 } |
| 977 | 962 |
| 978 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { | |
| 979 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | |
| 980 cricket::VoiceChannel voice_channel( | |
| 981 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | |
| 982 voice_media_channel, nullptr, "VoiceContentName", false); | |
| 983 | |
| 984 cricket::VoiceMediaInfo voice_media_info; | |
| 985 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | |
| 986 voice_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | |
| 987 voice_media_info.senders[0].local_stats[0].ssrc = 1; | |
| 988 voice_media_info.senders[0].packets_sent = 2; | |
| 989 voice_media_info.senders[0].bytes_sent = 3; | |
| 990 voice_media_info.senders[0].rtt_ms = 4500.0; | |
| 991 EXPECT_CALL(*voice_media_channel, GetStats(_)) | |
| 992 .WillOnce(DoAll(SetArgPointee<0>(voice_media_info), Return(true))); | |
| 993 | |
| 994 SessionStats session_stats; | |
| 995 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; | |
| 996 session_stats.transport_stats["TransportName"].transport_name = | |
| 997 "TransportName"; | |
| 998 | |
| 999 // Make sure the associated |RTCTransportStats| is created. | |
| 1000 cricket::TransportChannelStats channel_stats; | |
| 1001 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | |
| 1002 cricket::ConnectionInfo connection_info; | |
| 1003 connection_info.local_candidate = *CreateFakeCandidate( | |
| 1004 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42).get(); | |
| 1005 connection_info.remote_candidate = *CreateFakeCandidate( | |
| 1006 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42).get(); | |
| 1007 channel_stats.connection_infos.push_back(connection_info); | |
| 1008 session_stats.transport_stats["TransportName"].channel_stats.push_back( | |
| 1009 channel_stats); | |
| 1010 | |
| 1011 EXPECT_CALL(test_->session(), GetTransportStats(_)) | |
| 1012 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | |
| 1013 EXPECT_CALL(test_->session(), voice_channel()) | |
| 1014 .WillRepeatedly(Return(&voice_channel)); | |
| 1015 | |
| 1016 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | |
| 1017 | |
| 1018 RTCOutboundRTPStreamStats expected_audio( | |
| 1019 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); | |
| 1020 expected_audio.ssrc = "1"; | |
| 1021 expected_audio.is_remote = false; | |
| 1022 expected_audio.media_type = "audio"; | |
| 1023 expected_audio.transport_id = "RTCTransport_TransportName_" + | |
| 1024 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1025 expected_audio.packets_sent = 2; | |
| 1026 expected_audio.bytes_sent = 3; | |
| 1027 expected_audio.round_trip_time = 4.5; | |
| 1028 | |
| 1029 ASSERT(report->Get(expected_audio.id())); | |
| 1030 const RTCOutboundRTPStreamStats& audio = report->Get( | |
| 1031 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>(); | |
| 1032 EXPECT_EQ(audio, expected_audio); | |
| 1033 | |
| 1034 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); | |
| 1035 } | |
| 1036 | |
| 1037 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) { | |
| 1038 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); | |
| 1039 cricket::VideoChannel video_channel( | |
| 1040 test_->worker_thread(), test_->network_thread(), video_media_channel, | |
| 1041 nullptr, "VideoContentName", false); | |
| 1042 | |
| 1043 cricket::VideoMediaInfo video_media_info; | |
| 1044 video_media_info.senders.push_back(cricket::VideoSenderInfo()); | |
| 1045 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | |
| 1046 video_media_info.senders[0].local_stats[0].ssrc = 1; | |
| 1047 video_media_info.senders[0].firs_rcvd = 2; | |
| 1048 video_media_info.senders[0].plis_rcvd = 3; | |
| 1049 video_media_info.senders[0].nacks_rcvd = 4; | |
| 1050 video_media_info.senders[0].packets_sent = 5; | |
| 1051 video_media_info.senders[0].bytes_sent = 6; | |
| 1052 video_media_info.senders[0].rtt_ms = 7500.0; | |
| 1053 EXPECT_CALL(*video_media_channel, GetStats(_)) | |
| 1054 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | |
| 1055 | |
| 1056 SessionStats session_stats; | |
| 1057 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | |
| 1058 session_stats.transport_stats["TransportName"].transport_name = | |
| 1059 "TransportName"; | |
| 1060 | |
| 1061 // Make sure the associated |RTCTransportStats| is created. | |
| 1062 cricket::TransportChannelStats channel_stats; | |
| 1063 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | |
| 1064 cricket::ConnectionInfo connection_info; | |
| 1065 connection_info.local_candidate = *CreateFakeCandidate( | |
| 1066 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42).get(); | |
| 1067 connection_info.remote_candidate = *CreateFakeCandidate( | |
| 1068 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42).get(); | |
| 1069 channel_stats.connection_infos.push_back(connection_info); | |
| 1070 session_stats.transport_stats["TransportName"].channel_stats.push_back( | |
| 1071 channel_stats); | |
| 1072 | |
| 1073 EXPECT_CALL(test_->session(), GetTransportStats(_)) | |
| 1074 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | |
| 1075 EXPECT_CALL(test_->session(), video_channel()) | |
| 1076 .WillRepeatedly(Return(&video_channel)); | |
| 1077 | |
| 1078 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | |
| 1079 | |
| 1080 RTCOutboundRTPStreamStats expected_video( | |
| 1081 "RTCOutboundRTPVideoStream_1", report->timestamp_us()); | |
| 1082 expected_video.ssrc = "1"; | |
| 1083 expected_video.is_remote = false; | |
| 1084 expected_video.media_type = "video"; | |
| 1085 expected_video.transport_id = "RTCTransport_TransportName_" + | |
| 1086 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | |
| 1087 expected_video.fir_count = 2; | |
| 1088 expected_video.pli_count = 3; | |
| 1089 expected_video.nack_count = 4; | |
| 1090 expected_video.packets_sent = 5; | |
| 1091 expected_video.bytes_sent = 6; | |
| 1092 expected_video.round_trip_time = 7.5; | |
| 1093 | |
| 1094 ASSERT(report->Get(expected_video.id())); | |
| 1095 const RTCOutboundRTPStreamStats& video = report->Get( | |
| 1096 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); | |
| 1097 EXPECT_EQ(video, expected_video); | |
| 1098 | |
| 1099 EXPECT_TRUE(report->Get(*expected_video.transport_id)); | |
| 1100 } | |
| 1101 | |
| 1102 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) { | 963 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) { |
| 1103 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate( | 964 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate( |
| 1104 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42); | 965 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42); |
| 1105 std::unique_ptr<cricket::Candidate> rtp_remote_candidate = | 966 std::unique_ptr<cricket::Candidate> rtp_remote_candidate = |
| 1106 CreateFakeCandidate("42.42.42.42", 42, "protocol", | 967 CreateFakeCandidate("42.42.42.42", 42, "protocol", |
| 1107 cricket::LOCAL_PORT_TYPE, 42); | 968 cricket::LOCAL_PORT_TYPE, 42); |
| 1108 std::unique_ptr<cricket::Candidate> rtcp_local_candidate = | 969 std::unique_ptr<cricket::Candidate> rtcp_local_candidate = |
| 1109 CreateFakeCandidate("42.42.42.42", 42, "protocol", | 970 CreateFakeCandidate("42.42.42.42", 42, "protocol", |
| 1110 cricket::LOCAL_PORT_TYPE, 42); | 971 cricket::LOCAL_PORT_TYPE, 42); |
| 1111 std::unique_ptr<cricket::Candidate> rtcp_remote_candidate = | 972 std::unique_ptr<cricket::Candidate> rtcp_remote_candidate = |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1072 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
| 1212 }; | 1073 }; |
| 1213 | 1074 |
| 1214 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1075 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
| 1215 collector_->VerifyThreadUsageAndResultsMerging(); | 1076 collector_->VerifyThreadUsageAndResultsMerging(); |
| 1216 } | 1077 } |
| 1217 | 1078 |
| 1218 } // namespace | 1079 } // namespace |
| 1219 | 1080 |
| 1220 } // namespace webrtc | 1081 } // namespace webrtc |
| OLD | NEW |