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 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 | 1621 |
1622 ASSERT(report->Get(expected_video.id())); | 1622 ASSERT(report->Get(expected_video.id())); |
1623 const RTCOutboundRTPStreamStats& video = report->Get( | 1623 const RTCOutboundRTPStreamStats& video = report->Get( |
1624 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); | 1624 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); |
1625 EXPECT_EQ(video, expected_video); | 1625 EXPECT_EQ(video, expected_video); |
1626 | 1626 |
1627 EXPECT_TRUE(report->Get(*expected_video.transport_id)); | 1627 EXPECT_TRUE(report->Get(*expected_video.transport_id)); |
1628 EXPECT_TRUE(report->Get(*expected_video.codec_id)); | 1628 EXPECT_TRUE(report->Get(*expected_video.codec_id)); |
1629 } | 1629 } |
1630 | 1630 |
| 1631 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Default) { |
| 1632 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
| 1633 cricket::VoiceChannel voice_channel( |
| 1634 test_->worker_thread(), test_->network_thread(), test_->media_engine(), |
| 1635 voice_media_channel, nullptr, "VoiceContentName", kDefaultRtcpEnabled, |
| 1636 kDefaultSrtpRequired); |
| 1637 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); |
| 1638 cricket::VideoChannel video_channel( |
| 1639 test_->worker_thread(), test_->network_thread(), video_media_channel, |
| 1640 nullptr, "VideoContentName", kDefaultRtcpEnabled, kDefaultSrtpRequired); |
| 1641 |
| 1642 cricket::VoiceMediaInfo voice_media_info; |
| 1643 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); |
| 1644 voice_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); |
| 1645 voice_media_info.senders[0].local_stats[0].ssrc = 1; |
| 1646 voice_media_info.senders[0].packets_sent = 2; |
| 1647 voice_media_info.senders[0].bytes_sent = 3; |
| 1648 voice_media_info.senders[0].rtt_ms = -1; |
| 1649 voice_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42); |
| 1650 |
| 1651 cricket::VideoMediaInfo video_media_info; |
| 1652 video_media_info.senders.push_back(cricket::VideoSenderInfo()); |
| 1653 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); |
| 1654 video_media_info.senders[0].local_stats[0].ssrc = 1; |
| 1655 video_media_info.senders[0].firs_rcvd = 2; |
| 1656 video_media_info.senders[0].plis_rcvd = 3; |
| 1657 video_media_info.senders[0].nacks_rcvd = 4; |
| 1658 video_media_info.senders[0].packets_sent = 5; |
| 1659 video_media_info.senders[0].bytes_sent = 6; |
| 1660 video_media_info.senders[0].rtt_ms = -1; |
| 1661 video_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42); |
| 1662 |
| 1663 EXPECT_CALL(*voice_media_channel, GetStats(_)) |
| 1664 .WillOnce(DoAll(SetArgPointee<0>(voice_media_info), Return(true))); |
| 1665 EXPECT_CALL(*video_media_channel, GetStats(_)) |
| 1666 .WillOnce(DoAll(SetArgPointee<0>(video_media_info), Return(true))); |
| 1667 |
| 1668 SessionStats session_stats; |
| 1669 session_stats.proxy_to_transport["VoiceContentName"] = "TransportName"; |
| 1670 session_stats.proxy_to_transport["VideoContentName"] = "TransportName"; |
| 1671 session_stats.transport_stats["TransportName"].transport_name = |
| 1672 "TransportName"; |
| 1673 |
| 1674 // Make sure the associated |RTCTransportStats| is created. |
| 1675 cricket::TransportChannelStats channel_stats; |
| 1676 channel_stats.component = cricket::ICE_CANDIDATE_COMPONENT_RTP; |
| 1677 session_stats.transport_stats["TransportName"].channel_stats.push_back( |
| 1678 channel_stats); |
| 1679 |
| 1680 EXPECT_CALL(test_->session(), GetTransportStats(_)) |
| 1681 .WillRepeatedly(DoAll(SetArgPointee<0>(session_stats), Return(true))); |
| 1682 EXPECT_CALL(test_->session(), voice_channel()) |
| 1683 .WillRepeatedly(Return(&voice_channel)); |
| 1684 EXPECT_CALL(test_->session(), video_channel()) |
| 1685 .WillRepeatedly(Return(&video_channel)); |
| 1686 |
| 1687 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
| 1688 |
| 1689 RTCOutboundRTPStreamStats expected_audio( |
| 1690 "RTCOutboundRTPAudioStream_1", report->timestamp_us()); |
| 1691 expected_audio.ssrc = "1"; |
| 1692 expected_audio.is_remote = false; |
| 1693 expected_audio.media_type = "audio"; |
| 1694 expected_audio.transport_id = "RTCTransport_TransportName_" + |
| 1695 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1696 expected_audio.codec_id = "RTCCodec_OutboundAudio_42"; |
| 1697 expected_audio.packets_sent = 2; |
| 1698 expected_audio.bytes_sent = 3; |
| 1699 // |expected_audio.round_trip_time| should be undefined. |
| 1700 |
| 1701 ASSERT(report->Get(expected_audio.id())); |
| 1702 const RTCOutboundRTPStreamStats& audio = report->Get( |
| 1703 expected_audio.id())->cast_to<RTCOutboundRTPStreamStats>(); |
| 1704 EXPECT_EQ(audio, expected_audio); |
| 1705 |
| 1706 RTCOutboundRTPStreamStats expected_video( |
| 1707 "RTCOutboundRTPVideoStream_1", report->timestamp_us()); |
| 1708 expected_video.ssrc = "1"; |
| 1709 expected_video.is_remote = false; |
| 1710 expected_video.media_type = "video"; |
| 1711 expected_video.transport_id = "RTCTransport_TransportName_" + |
| 1712 rtc::ToString<>(cricket::ICE_CANDIDATE_COMPONENT_RTP); |
| 1713 expected_video.codec_id = "RTCCodec_OutboundVideo_42"; |
| 1714 expected_video.fir_count = 2; |
| 1715 expected_video.pli_count = 3; |
| 1716 expected_video.nack_count = 4; |
| 1717 expected_video.packets_sent = 5; |
| 1718 expected_video.bytes_sent = 6; |
| 1719 // |expected_video.round_trip_time| should be undefined. |
| 1720 |
| 1721 ASSERT(report->Get(expected_video.id())); |
| 1722 const RTCOutboundRTPStreamStats& video = report->Get( |
| 1723 expected_video.id())->cast_to<RTCOutboundRTPStreamStats>(); |
| 1724 EXPECT_EQ(video, expected_video); |
| 1725 } |
| 1726 |
1631 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) { | 1727 TEST_F(RTCStatsCollectorTest, CollectRTCTransportStats) { |
1632 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate( | 1728 std::unique_ptr<cricket::Candidate> rtp_local_candidate = CreateFakeCandidate( |
1633 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42); | 1729 "42.42.42.42", 42, "protocol", cricket::LOCAL_PORT_TYPE, 42); |
1634 std::unique_ptr<cricket::Candidate> rtp_remote_candidate = | 1730 std::unique_ptr<cricket::Candidate> rtp_remote_candidate = |
1635 CreateFakeCandidate("42.42.42.42", 42, "protocol", | 1731 CreateFakeCandidate("42.42.42.42", 42, "protocol", |
1636 cricket::LOCAL_PORT_TYPE, 42); | 1732 cricket::LOCAL_PORT_TYPE, 42); |
1637 std::unique_ptr<cricket::Candidate> rtcp_local_candidate = | 1733 std::unique_ptr<cricket::Candidate> rtcp_local_candidate = |
1638 CreateFakeCandidate("42.42.42.42", 42, "protocol", | 1734 CreateFakeCandidate("42.42.42.42", 42, "protocol", |
1639 cricket::LOCAL_PORT_TYPE, 42); | 1735 cricket::LOCAL_PORT_TYPE, 42); |
1640 std::unique_ptr<cricket::Candidate> rtcp_remote_candidate = | 1736 std::unique_ptr<cricket::Candidate> rtcp_remote_candidate = |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1895 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
1800 }; | 1896 }; |
1801 | 1897 |
1802 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1898 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
1803 collector_->VerifyThreadUsageAndResultsMerging(); | 1899 collector_->VerifyThreadUsageAndResultsMerging(); |
1804 } | 1900 } |
1805 | 1901 |
1806 } // namespace | 1902 } // namespace |
1807 | 1903 |
1808 } // namespace webrtc | 1904 } // namespace webrtc |
OLD | NEW |