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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 *os << stats.ToString(); | 94 *os << stats.ToString(); |
95 } | 95 } |
96 | 96 |
97 void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) { | 97 void PrintTo(const RTCTransportStats& stats, ::std::ostream* os) { |
98 *os << stats.ToString(); | 98 *os << stats.ToString(); |
99 } | 99 } |
100 | 100 |
101 namespace { | 101 namespace { |
102 | 102 |
103 const int64_t kGetStatsReportTimeoutMs = 1000; | 103 const int64_t kGetStatsReportTimeoutMs = 1000; |
104 const bool kDefaultUseRtcpChannel = false; | |
pthatcher1
2016/11/30 19:16:17
"bool rtcp" in BaseChannel is really "rtcp_enabled
Taylor Brandstetter
2016/12/01 02:41:34
Done. I'm just bad at naming things.
| |
105 const bool kDefaultSecureRequired = true; | |
104 | 106 |
105 struct CertificateInfo { | 107 struct CertificateInfo { |
106 rtc::scoped_refptr<rtc::RTCCertificate> certificate; | 108 rtc::scoped_refptr<rtc::RTCCertificate> certificate; |
107 std::vector<std::string> ders; | 109 std::vector<std::string> ders; |
108 std::vector<std::string> pems; | 110 std::vector<std::string> pems; |
109 std::vector<std::string> fingerprints; | 111 std::vector<std::string> fingerprints; |
110 }; | 112 }; |
111 | 113 |
112 std::unique_ptr<CertificateInfo> CreateFakeCertificateAndInfoFromDers( | 114 std::unique_ptr<CertificateInfo> CreateFakeCertificateAndInfoFromDers( |
113 const std::vector<std::string>& ders) { | 115 const std::vector<std::string>& ders) { |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 | 780 |
779 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); | 781 rtc::scoped_refptr<const RTCStatsReport> report = GetStatsReport(); |
780 ExpectReportContainsCertificateInfo(report, *local_certinfo.get()); | 782 ExpectReportContainsCertificateInfo(report, *local_certinfo.get()); |
781 ExpectReportContainsCertificateInfo(report, *remote_certinfo.get()); | 783 ExpectReportContainsCertificateInfo(report, *remote_certinfo.get()); |
782 } | 784 } |
783 | 785 |
784 TEST_F(RTCStatsCollectorTest, CollectRTCCodecStats) { | 786 TEST_F(RTCStatsCollectorTest, CollectRTCCodecStats) { |
785 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | 787 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
786 cricket::VoiceChannel voice_channel( | 788 cricket::VoiceChannel voice_channel( |
787 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | 789 test_->worker_thread(), test_->network_thread(), test_->media_engine(), |
788 voice_media_channel, nullptr, "VoiceContentName", false); | 790 voice_media_channel, nullptr, "VoiceContentName", kDefaultUseRtcpChannel, |
791 kDefaultSecureRequired); | |
789 | 792 |
790 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); | 793 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); |
791 cricket::VideoChannel video_channel( | 794 cricket::VideoChannel video_channel( |
792 test_->worker_thread(), test_->network_thread(), video_media_channel, | 795 test_->worker_thread(), test_->network_thread(), video_media_channel, |
793 nullptr, "VideoContentName", false); | 796 nullptr, "VideoContentName", kDefaultUseRtcpChannel, |
797 kDefaultSecureRequired); | |
794 | 798 |
795 // Audio | 799 // Audio |
796 cricket::VoiceMediaInfo voice_media_info; | 800 cricket::VoiceMediaInfo voice_media_info; |
797 | 801 |
798 RtpCodecParameters inbound_audio_codec; | 802 RtpCodecParameters inbound_audio_codec; |
799 inbound_audio_codec.payload_type = 1; | 803 inbound_audio_codec.payload_type = 1; |
800 inbound_audio_codec.mime_type = "opus"; | 804 inbound_audio_codec.mime_type = "opus"; |
801 inbound_audio_codec.clock_rate = 1337; | 805 inbound_audio_codec.clock_rate = 1337; |
802 voice_media_info.receive_codecs.insert( | 806 voice_media_info.receive_codecs.insert( |
803 std::make_pair(inbound_audio_codec.payload_type, inbound_audio_codec)); | 807 std::make_pair(inbound_audio_codec.payload_type, inbound_audio_codec)); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1396 EXPECT_TRUE(report->Get(expected_remote_video_track.id())); | 1400 EXPECT_TRUE(report->Get(expected_remote_video_track.id())); |
1397 EXPECT_EQ(expected_remote_video_track, | 1401 EXPECT_EQ(expected_remote_video_track, |
1398 report->Get(expected_remote_video_track.id())->cast_to< | 1402 report->Get(expected_remote_video_track.id())->cast_to< |
1399 RTCMediaStreamTrackStats>()); | 1403 RTCMediaStreamTrackStats>()); |
1400 } | 1404 } |
1401 | 1405 |
1402 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { | 1406 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Audio) { |
1403 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | 1407 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
1404 cricket::VoiceChannel voice_channel( | 1408 cricket::VoiceChannel voice_channel( |
1405 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | 1409 test_->worker_thread(), test_->network_thread(), test_->media_engine(), |
1406 voice_media_channel, nullptr, "VoiceContentName", false); | 1410 voice_media_channel, nullptr, "VoiceContentName", kDefaultUseRtcpChannel, |
1411 kDefaultSecureRequired); | |
1407 | 1412 |
1408 cricket::VoiceMediaInfo voice_media_info; | 1413 cricket::VoiceMediaInfo voice_media_info; |
1409 | 1414 |
1410 voice_media_info.receivers.push_back(cricket::VoiceReceiverInfo()); | 1415 voice_media_info.receivers.push_back(cricket::VoiceReceiverInfo()); |
1411 voice_media_info.receivers[0].local_stats.push_back( | 1416 voice_media_info.receivers[0].local_stats.push_back( |
1412 cricket::SsrcReceiverInfo()); | 1417 cricket::SsrcReceiverInfo()); |
1413 voice_media_info.receivers[0].local_stats[0].ssrc = 1; | 1418 voice_media_info.receivers[0].local_stats[0].ssrc = 1; |
1414 voice_media_info.receivers[0].packets_rcvd = 2; | 1419 voice_media_info.receivers[0].packets_rcvd = 2; |
1415 voice_media_info.receivers[0].bytes_rcvd = 3; | 1420 voice_media_info.receivers[0].bytes_rcvd = 3; |
1416 voice_media_info.receivers[0].codec_payload_type = rtc::Optional<int>(42); | 1421 voice_media_info.receivers[0].codec_payload_type = rtc::Optional<int>(42); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1464 EXPECT_EQ(audio, expected_audio); | 1469 EXPECT_EQ(audio, expected_audio); |
1465 | 1470 |
1466 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); | 1471 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); |
1467 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); | 1472 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); |
1468 } | 1473 } |
1469 | 1474 |
1470 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) { | 1475 TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) { |
1471 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); | 1476 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); |
1472 cricket::VideoChannel video_channel( | 1477 cricket::VideoChannel video_channel( |
1473 test_->worker_thread(), test_->network_thread(), video_media_channel, | 1478 test_->worker_thread(), test_->network_thread(), video_media_channel, |
1474 nullptr, "VideoContentName", false); | 1479 nullptr, "VideoContentName", kDefaultUseRtcpChannel, |
1480 kDefaultSecureRequired); | |
1475 | 1481 |
1476 cricket::VideoMediaInfo video_media_info; | 1482 cricket::VideoMediaInfo video_media_info; |
1477 | 1483 |
1478 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); | 1484 video_media_info.receivers.push_back(cricket::VideoReceiverInfo()); |
1479 video_media_info.receivers[0].local_stats.push_back( | 1485 video_media_info.receivers[0].local_stats.push_back( |
1480 cricket::SsrcReceiverInfo()); | 1486 cricket::SsrcReceiverInfo()); |
1481 video_media_info.receivers[0].local_stats[0].ssrc = 1; | 1487 video_media_info.receivers[0].local_stats[0].ssrc = 1; |
1482 video_media_info.receivers[0].packets_rcvd = 2; | 1488 video_media_info.receivers[0].packets_rcvd = 2; |
1483 video_media_info.receivers[0].bytes_rcvd = 3; | 1489 video_media_info.receivers[0].bytes_rcvd = 3; |
1484 video_media_info.receivers[0].fraction_lost = 4.5f; | 1490 video_media_info.receivers[0].fraction_lost = 4.5f; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1536 EXPECT_EQ(video, expected_video); | 1542 EXPECT_EQ(video, expected_video); |
1537 | 1543 |
1538 EXPECT_TRUE(report->Get(*expected_video.transport_id)); | 1544 EXPECT_TRUE(report->Get(*expected_video.transport_id)); |
1539 EXPECT_TRUE(report->Get(*video.codec_id)); | 1545 EXPECT_TRUE(report->Get(*video.codec_id)); |
1540 } | 1546 } |
1541 | 1547 |
1542 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { | 1548 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Audio) { |
1543 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); | 1549 MockVoiceMediaChannel* voice_media_channel = new MockVoiceMediaChannel(); |
1544 cricket::VoiceChannel voice_channel( | 1550 cricket::VoiceChannel voice_channel( |
1545 test_->worker_thread(), test_->network_thread(), test_->media_engine(), | 1551 test_->worker_thread(), test_->network_thread(), test_->media_engine(), |
1546 voice_media_channel, nullptr, "VoiceContentName", false); | 1552 voice_media_channel, nullptr, "VoiceContentName", kDefaultUseRtcpChannel, |
1553 kDefaultSecureRequired); | |
1547 | 1554 |
1548 cricket::VoiceMediaInfo voice_media_info; | 1555 cricket::VoiceMediaInfo voice_media_info; |
1549 | 1556 |
1550 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); | 1557 voice_media_info.senders.push_back(cricket::VoiceSenderInfo()); |
1551 voice_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | 1558 voice_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); |
1552 voice_media_info.senders[0].local_stats[0].ssrc = 1; | 1559 voice_media_info.senders[0].local_stats[0].ssrc = 1; |
1553 voice_media_info.senders[0].packets_sent = 2; | 1560 voice_media_info.senders[0].packets_sent = 2; |
1554 voice_media_info.senders[0].bytes_sent = 3; | 1561 voice_media_info.senders[0].bytes_sent = 3; |
1555 voice_media_info.senders[0].rtt_ms = 4500; | 1562 voice_media_info.senders[0].rtt_ms = 4500; |
1556 voice_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42); | 1563 voice_media_info.senders[0].codec_payload_type = rtc::Optional<int>(42); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1601 EXPECT_EQ(audio, expected_audio); | 1608 EXPECT_EQ(audio, expected_audio); |
1602 | 1609 |
1603 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); | 1610 EXPECT_TRUE(report->Get(*expected_audio.transport_id)); |
1604 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); | 1611 EXPECT_TRUE(report->Get(*expected_audio.codec_id)); |
1605 } | 1612 } |
1606 | 1613 |
1607 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) { | 1614 TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) { |
1608 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); | 1615 MockVideoMediaChannel* video_media_channel = new MockVideoMediaChannel(); |
1609 cricket::VideoChannel video_channel( | 1616 cricket::VideoChannel video_channel( |
1610 test_->worker_thread(), test_->network_thread(), video_media_channel, | 1617 test_->worker_thread(), test_->network_thread(), video_media_channel, |
1611 nullptr, "VideoContentName", false); | 1618 nullptr, "VideoContentName", kDefaultUseRtcpChannel, |
1619 kDefaultSecureRequired); | |
1612 | 1620 |
1613 cricket::VideoMediaInfo video_media_info; | 1621 cricket::VideoMediaInfo video_media_info; |
1614 | 1622 |
1615 video_media_info.senders.push_back(cricket::VideoSenderInfo()); | 1623 video_media_info.senders.push_back(cricket::VideoSenderInfo()); |
1616 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); | 1624 video_media_info.senders[0].local_stats.push_back(cricket::SsrcSenderInfo()); |
1617 video_media_info.senders[0].local_stats[0].ssrc = 1; | 1625 video_media_info.senders[0].local_stats[0].ssrc = 1; |
1618 video_media_info.senders[0].firs_rcvd = 2; | 1626 video_media_info.senders[0].firs_rcvd = 2; |
1619 video_media_info.senders[0].plis_rcvd = 3; | 1627 video_media_info.senders[0].plis_rcvd = 3; |
1620 video_media_info.senders[0].nacks_rcvd = 4; | 1628 video_media_info.senders[0].nacks_rcvd = 4; |
1621 video_media_info.senders[0].packets_sent = 5; | 1629 video_media_info.senders[0].packets_sent = 5; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1787 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; | 1795 rtc::scoped_refptr<FakeRTCStatsCollector> collector_; |
1788 }; | 1796 }; |
1789 | 1797 |
1790 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { | 1798 TEST_F(RTCStatsCollectorTestWithFakeCollector, ThreadUsageAndResultsMerging) { |
1791 collector_->VerifyThreadUsageAndResultsMerging(); | 1799 collector_->VerifyThreadUsageAndResultsMerging(); |
1792 } | 1800 } |
1793 | 1801 |
1794 } // namespace | 1802 } // namespace |
1795 | 1803 |
1796 } // namespace webrtc | 1804 } // namespace webrtc |
OLD | NEW |