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 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | |
13 #include <set> | 12 #include <set> |
14 | 13 |
15 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
18 #include "webrtc/common_types.h" | 17 #include "webrtc/common_types.h" |
19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 18 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" | 21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 receiver_ = receiver; | 61 receiver_ = receiver; |
63 } | 62 } |
64 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { | 63 void SimulateNetworkDelay(int64_t delay_ms, SimulatedClock* clock) { |
65 clock_ = clock; | 64 clock_ = clock; |
66 delay_ms_ = delay_ms; | 65 delay_ms_ = delay_ms; |
67 } | 66 } |
68 bool SendRtp(const uint8_t* data, | 67 bool SendRtp(const uint8_t* data, |
69 size_t len, | 68 size_t len, |
70 const PacketOptions& options) override { | 69 const PacketOptions& options) override { |
71 RTPHeader header; | 70 RTPHeader header; |
72 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 71 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
73 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); | 72 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); |
74 ++rtp_packets_sent_; | 73 ++rtp_packets_sent_; |
75 last_rtp_header_ = header; | 74 last_rtp_header_ = header; |
76 return true; | 75 return true; |
77 } | 76 } |
78 bool SendRtcp(const uint8_t* data, size_t len) override { | 77 bool SendRtcp(const uint8_t* data, size_t len) override { |
79 test::RtcpPacketParser parser; | 78 test::RtcpPacketParser parser; |
80 parser.Parse(static_cast<const uint8_t*>(data), len); | 79 parser.Parse(static_cast<const uint8_t*>(data), len); |
81 last_nack_list_ = parser.nack_item()->last_nack_list(); | 80 last_nack_list_ = parser.nack_item()->last_nack_list(); |
82 | 81 |
(...skipping 26 matching lines...) Expand all Loading... |
109 config.rtt_stats = &rtt_stats_; | 108 config.rtt_stats = &rtt_stats_; |
110 | 109 |
111 impl_.reset(new ModuleRtpRtcpImpl(config)); | 110 impl_.reset(new ModuleRtpRtcpImpl(config)); |
112 impl_->SetRTCPStatus(RtcpMode::kCompound); | 111 impl_->SetRTCPStatus(RtcpMode::kCompound); |
113 | 112 |
114 transport_.SimulateNetworkDelay(kOneWayNetworkDelayMs, clock); | 113 transport_.SimulateNetworkDelay(kOneWayNetworkDelayMs, clock); |
115 } | 114 } |
116 | 115 |
117 RtcpPacketTypeCounter packets_sent_; | 116 RtcpPacketTypeCounter packets_sent_; |
118 RtcpPacketTypeCounter packets_received_; | 117 RtcpPacketTypeCounter packets_received_; |
119 std::unique_ptr<ReceiveStatistics> receive_statistics_; | 118 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; |
120 SendTransport transport_; | 119 SendTransport transport_; |
121 RtcpRttStatsTestImpl rtt_stats_; | 120 RtcpRttStatsTestImpl rtt_stats_; |
122 std::unique_ptr<ModuleRtpRtcpImpl> impl_; | 121 rtc::scoped_ptr<ModuleRtpRtcpImpl> impl_; |
123 uint32_t remote_ssrc_; | 122 uint32_t remote_ssrc_; |
124 | 123 |
125 void SetRemoteSsrc(uint32_t ssrc) { | 124 void SetRemoteSsrc(uint32_t ssrc) { |
126 remote_ssrc_ = ssrc; | 125 remote_ssrc_ = ssrc; |
127 impl_->SetRemoteSSRC(ssrc); | 126 impl_->SetRemoteSSRC(ssrc); |
128 } | 127 } |
129 | 128 |
130 void RtcpPacketTypesCounterUpdated( | 129 void RtcpPacketTypesCounterUpdated( |
131 uint32_t ssrc, | 130 uint32_t ssrc, |
132 const RtcpPacketTypeCounter& packet_counter) override { | 131 const RtcpPacketTypeCounter& packet_counter) override { |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); | 542 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); |
544 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); | 543 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); |
545 | 544 |
546 // Send module receives the request. | 545 // Send module receives the request. |
547 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); | 546 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); |
548 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); | 547 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); |
549 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); | 548 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); |
550 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); | 549 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); |
551 } | 550 } |
552 } // namespace webrtc | 551 } // namespace webrtc |
OLD | NEW |