Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc

Issue 2986543002: Remove RtpRtcp::RemoteRTCPStat(RTCPSenderInfo*) as unused (Closed)
Patch Set: rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Too short feedback packet. 167 // Too short feedback packet.
168 const uint8_t bad_packet[] = {0x81, rtcp::Rtpfb::kPacketType, 0, 0}; 168 const uint8_t bad_packet[] = {0x81, rtcp::Rtpfb::kPacketType, 0, 0};
169 169
170 // TODO(danilchap): Add expectation RtcpPacketTypesCounterUpdated 170 // TODO(danilchap): Add expectation RtcpPacketTypesCounterUpdated
171 // is not called once parser would be adjusted to avoid that callback on 171 // is not called once parser would be adjusted to avoid that callback on
172 // semi-valid packets. 172 // semi-valid packets.
173 InjectRtcpPacket(bad_packet); 173 InjectRtcpPacket(bad_packet);
174 } 174 }
175 175
176 TEST_F(RtcpReceiverTest, InjectSrPacket) { 176 TEST_F(RtcpReceiverTest, InjectSrPacket) {
177 RTCPSenderInfo info; 177 EXPECT_FALSE(rtcp_receiver_.NTP(nullptr, nullptr, nullptr, nullptr, nullptr));
178 EXPECT_EQ(-1, rtcp_receiver_.SenderInfoReceived(&info));
179 178
180 int64_t now = system_clock_.TimeInMilliseconds(); 179 int64_t now = system_clock_.TimeInMilliseconds();
181 rtcp::SenderReport sr; 180 rtcp::SenderReport sr;
182 sr.SetSenderSsrc(kSenderSsrc); 181 sr.SetSenderSsrc(kSenderSsrc);
183 182
184 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty())); 183 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty()));
185 EXPECT_CALL(bandwidth_observer_, 184 EXPECT_CALL(bandwidth_observer_,
186 OnReceivedRtcpReceiverReport(IsEmpty(), _, now)); 185 OnReceivedRtcpReceiverReport(IsEmpty(), _, now));
187 InjectRtcpPacket(sr); 186 InjectRtcpPacket(sr);
188 187
189 EXPECT_EQ(0, rtcp_receiver_.SenderInfoReceived(&info)); 188 EXPECT_TRUE(rtcp_receiver_.NTP(nullptr, nullptr, nullptr, nullptr, nullptr));
190 } 189 }
191 190
192 TEST_F(RtcpReceiverTest, InjectSrPacketFromUnknownSender) { 191 TEST_F(RtcpReceiverTest, InjectSrPacketFromUnknownSender) {
193 int64_t now = system_clock_.TimeInMilliseconds(); 192 int64_t now = system_clock_.TimeInMilliseconds();
194 rtcp::SenderReport sr; 193 rtcp::SenderReport sr;
195 sr.SetSenderSsrc(kUnknownSenderSsrc); 194 sr.SetSenderSsrc(kUnknownSenderSsrc);
196 195
197 // The parser will handle report blocks in Sender Report from other than his 196 // The parser will handle report blocks in Sender Report from other than his
198 // expected peer. 197 // expected peer.
199 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_)); 198 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(_));
200 EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, now)); 199 EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, now));
201 InjectRtcpPacket(sr); 200 InjectRtcpPacket(sr);
202 201
203 // But will not flag that he's gotten sender information. 202 // But will not flag that he's gotten sender information.
204 RTCPSenderInfo info; 203 EXPECT_FALSE(rtcp_receiver_.NTP(nullptr, nullptr, nullptr, nullptr, nullptr));
205 EXPECT_EQ(-1, rtcp_receiver_.SenderInfoReceived(&info));
206 } 204 }
207 205
208 TEST_F(RtcpReceiverTest, InjectSrPacketCalculatesRTT) { 206 TEST_F(RtcpReceiverTest, InjectSrPacketCalculatesRTT) {
209 Random r(0x0123456789abcdef); 207 Random r(0x0123456789abcdef);
210 const int64_t kRttMs = r.Rand(1, 9 * 3600 * 1000); 208 const int64_t kRttMs = r.Rand(1, 9 * 3600 * 1000);
211 const uint32_t kDelayNtp = r.Rand(0, 0x7fffffff); 209 const uint32_t kDelayNtp = r.Rand(0, 0x7fffffff);
212 const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp); 210 const int64_t kDelayMs = CompactNtpRttToMs(kDelayNtp);
213 211
214 int64_t rtt_ms = 0; 212 int64_t rtt_ms = 0;
215 EXPECT_EQ( 213 EXPECT_EQ(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 TEST_F(RtcpReceiverTest, InjectRrPacket) { 267 TEST_F(RtcpReceiverTest, InjectRrPacket) {
270 int64_t now = system_clock_.TimeInMilliseconds(); 268 int64_t now = system_clock_.TimeInMilliseconds();
271 rtcp::ReceiverReport rr; 269 rtcp::ReceiverReport rr;
272 rr.SetSenderSsrc(kSenderSsrc); 270 rr.SetSenderSsrc(kSenderSsrc);
273 271
274 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty())); 272 EXPECT_CALL(rtp_rtcp_impl_, OnReceivedRtcpReportBlocks(IsEmpty()));
275 EXPECT_CALL(bandwidth_observer_, 273 EXPECT_CALL(bandwidth_observer_,
276 OnReceivedRtcpReceiverReport(IsEmpty(), _, now)); 274 OnReceivedRtcpReceiverReport(IsEmpty(), _, now));
277 InjectRtcpPacket(rr); 275 InjectRtcpPacket(rr);
278 276
279 RTCPSenderInfo info;
280 EXPECT_EQ(-1, rtcp_receiver_.SenderInfoReceived(&info));
281 EXPECT_EQ(now, rtcp_receiver_.LastReceivedReceiverReport()); 277 EXPECT_EQ(now, rtcp_receiver_.LastReceivedReceiverReport());
282 std::vector<RTCPReportBlock> report_blocks; 278 std::vector<RTCPReportBlock> report_blocks;
283 rtcp_receiver_.StatisticsReceived(&report_blocks); 279 rtcp_receiver_.StatisticsReceived(&report_blocks);
284 EXPECT_TRUE(report_blocks.empty()); 280 EXPECT_TRUE(report_blocks.empty());
285 } 281 }
286 282
287 TEST_F(RtcpReceiverTest, InjectRrPacketWithReportBlockNotToUsIgnored) { 283 TEST_F(RtcpReceiverTest, InjectRrPacketWithReportBlockNotToUsIgnored) {
288 int64_t now = system_clock_.TimeInMilliseconds(); 284 int64_t now = system_clock_.TimeInMilliseconds();
289 rtcp::ReportBlock rb; 285 rtcp::ReportBlock rb;
290 rb.SetMediaSsrc(kNotToUsSsrc); 286 rb.SetMediaSsrc(kNotToUsSsrc);
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 1239
1244 rtcp::ExtendedReports xr; 1240 rtcp::ExtendedReports xr;
1245 xr.SetTargetBitrate(bitrate); 1241 xr.SetTargetBitrate(bitrate);
1246 1242
1247 EXPECT_CALL(bitrate_allocation_observer_, 1243 EXPECT_CALL(bitrate_allocation_observer_,
1248 OnBitrateAllocationUpdated(expected_allocation)); 1244 OnBitrateAllocationUpdated(expected_allocation));
1249 InjectRtcpPacket(xr); 1245 InjectRtcpPacket(xr);
1250 } 1246 }
1251 1247
1252 } // namespace webrtc 1248 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698