| 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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 nullptr, "VideoContentName", false); | 1376 nullptr, "VideoContentName", false); |
| 1377 | 1377 |
| 1378 cricket::VideoMediaInfo video_media_info; | 1378 cricket::VideoMediaInfo video_media_info; |
| 1379 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); | 1379 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); |
| 1380 video_media_info.receivers[0].local_stats.push_back( | 1380 video_media_info.receivers[0].local_stats.push_back( |
| 1381 cricket::SsrcReceiverInfo()); | 1381 cricket::SsrcReceiverInfo()); |
| 1382 video_media_info.receivers[0].local_stats[0].ssrc = 1; | 1382 video_media_info.receivers[0].local_stats[0].ssrc = 1; |
| 1383 video_media_info.receivers[0].packets_rcvd = 2; | 1383 video_media_info.receivers[0].packets_rcvd = 2; |
| 1384 video_media_info.receivers[0].bytes_rcvd = 3; | 1384 video_media_info.receivers[0].bytes_rcvd = 3; |
| 1385 video_media_info.receivers[0].fraction_lost = 4.5f; | 1385 video_media_info.receivers[0].fraction_lost = 4.5f; |
| 1386 video_media_info.receivers[0].firs_sent = 5; |
| 1387 video_media_info.receivers[0].plis_sent = 6; |
| 1388 video_media_info.receivers[0].nacks_sent = 7; |
| 1386 EXPECT_CALL(*video_media_channel, GetStats(_)) | 1389 EXPECT_CALL(*video_media_channel, GetStats(_)) |
| 1387 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); | 1390 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
| 1388 | 1391 |
| 1389 SessionStats session_stats; | 1392 SessionStats session_stats; |
| 1390 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; | 1393 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
| 1391 session_stats.transport_stats["TransportName"].transport_name = | 1394 session_stats.transport_stats["TransportName"].transport_name = |
| 1392 "TransportName"; | 1395 "TransportName"; |
| 1393 | 1396 |
| 1394 // Make sure the associated |RTCTransportStats| is created. | 1397 // Make sure the associated |RTCTransportStats| is created. |
| 1395 cricket::TransportChannelStats channel_stats; | 1398 cricket::TransportChannelStats channel_stats; |
| 1396 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; | 1399 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
| 1397 session_stats.transport_stats["TransportName"].channel_stats.push_back( | 1400 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
| 1398 channel_stats); | 1401 channel_stats); |
| 1399 | 1402 |
| 1400 EXPECT_CALL(test_->session(), GetTransportStats(_)) | 1403 EXPECT_CALL(test_->session(), GetTransportStats(_)) |
| 1401 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); | 1404 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); |
| 1402 EXPECT_CALL(test_->session(), video_channel()) | 1405 EXPECT_CALL(test_->session(), video_channel()) |
| 1403 .WillRepeatedly(Return(&video_channel)); | 1406 .WillRepeatedly(Return(&video_channel)); |
| 1404 | 1407 |
| 1405 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 1408 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
| 1406 | 1409 |
| 1407 RTCInboundRTPStreamStats expected_audio( | 1410 RTCInboundRTPStreamStats expected_video( |
| 1408 "RTCInboundRTPVideoStream_1", report->timestamp_us()); | 1411 "RTCInboundRTPVideoStream_1", report->timestamp_us()); |
| 1409 expected_audio.ssrc = "1"; | 1412 expected_video.ssrc = "1"; |
| 1410 expected_audio.is_remote = false; | 1413 expected_video.is_remote = false; |
| 1411 expected_audio.media_type = "video"; | 1414 expected_video.media_type = "video"; |
| 1412 expected_audio.transport_id = "RTCTransport_TransportName_" + | 1415 expected_video.transport_id = "RTCTransport_TransportName_" + |
| 1413 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); | 1416 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1414 expected_audio.packets_received = 2; | 1417 expected_video.fir_count = 5; |
| 1415 expected_audio.bytes_received = 3; | 1418 expected_video.pli_count = 6; |
| 1416 expected_audio.fraction_lost = 4.5; | 1419 expected_video.nack_count = 7; |
| 1420 expected_video.packets_received = 2; |
| 1421 expected_video.bytes_received = 3; |
| 1422 expected_video.fraction_lost = 4.5; |
| 1417 | 1423 |
| 1418 ASSERT(report->Get(expected_audio.id())); | 1424 ASSERT(report->Get(expected_video.id())); |
| 1419 const RTCInboundRTPStreamStats& audio = report->Get( | 1425 const RTCInboundRTPStreamStats& video = report->Get( |
| 1420 expected_audio.id())->cast_to<RTCInboundRTPStreamStats>(); | 1426 expected_video.id())->cast_to<RTCInboundRTPStreamStats>(); |
| 1421 EXPECT_EQ(audio, expected_audio); | 1427 EXPECT_EQ(video, expected_video); |
| 1422 | 1428 |
| 1423 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); | 1429 EXPECT_TRUE(report->Get(*expected_video.transport_id)); |
| 1424 } | 1430 } |
| 1425 | 1431 |
| 1426 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { | 1432 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { |
| 1427 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | 1433 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
| 1428 cricket::VoiceChannel voice_channel( | 1434 cricket::VoiceChannel voice_channel( |
| 1429 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | 1435 test_->worker_thread(), test_->network_thread(), test_->media_engine(), |
| 1430 voice_media_channel, nullptr, "VoiceContentName", false); | 1436 voice_media_channel, nullptr, "VoiceContentName", false); |
| 1431 | 1437 |
| 1432 cricket::VoiceMediaInfo voice_media_info; | 1438 cricket::VoiceMediaInfo voice_media_info; |
| 1433 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | 1439 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1653 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
| 1648 }; | 1654 }; |
| 1649 | 1655 |
| 1650 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1656 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
| 1651 collector_->VerifyThreadUsageAndResultsMerging(); | 1657 collector_->VerifyThreadUsageAndResultsMerging(); |
| 1652 } | 1658 } |
| 1653 | 1659 |
| 1654 } // namespace | 1660 } // namespace |
| 1655 | 1661 |
| 1656 } // namespace webrtc | 1662 } // namespace webrtc |
| OLD | NEW |