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

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

Issue 2070673002: Test RtcpParser rewritten to use rtcp packet classes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: reinterpret_cast -> static_cast Created 4 years, 3 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) 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
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const PacketOptions& options) override { 72 const PacketOptions& options) override {
73 RTPHeader header; 73 RTPHeader header;
74 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 74 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
75 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header)); 75 EXPECT_TRUE(parser->Parse(static_cast<const uint8_t*>(data), len, &header));
76 ++rtp_packets_sent_; 76 ++rtp_packets_sent_;
77 last_rtp_header_ = header; 77 last_rtp_header_ = header;
78 return true; 78 return true;
79 } 79 }
80 bool SendRtcp(const uint8_t* data, size_t len) override { 80 bool SendRtcp(const uint8_t* data, size_t len) override {
81 test::RtcpPacketParser parser; 81 test::RtcpPacketParser parser;
82 parser.Parse(static_cast<const uint8_t*>(data), len); 82 parser.Parse(data, len);
83 last_nack_list_ = parser.nack_item()->last_nack_list(); 83 last_nack_list_ = parser.nack()->packet_ids();
84 84
85 if (clock_) { 85 if (clock_) {
86 clock_->AdvanceTimeMilliseconds(delay_ms_); 86 clock_->AdvanceTimeMilliseconds(delay_ms_);
87 } 87 }
88 EXPECT_TRUE(receiver_ != NULL); 88 EXPECT_TRUE(receiver_);
89 EXPECT_EQ(0, receiver_->IncomingRtcpPacket( 89 EXPECT_EQ(0, receiver_->IncomingRtcpPacket(data, len));
90 static_cast<const uint8_t*>(data), len));
91 return true; 90 return true;
92 } 91 }
93 ModuleRtpRtcpImpl* receiver_; 92 ModuleRtpRtcpImpl* receiver_;
94 SimulatedClock* clock_; 93 SimulatedClock* clock_;
95 int64_t delay_ms_; 94 int64_t delay_ms_;
96 int rtp_packets_sent_; 95 int rtp_packets_sent_;
97 RTPHeader last_rtp_header_; 96 RTPHeader last_rtp_header_;
98 std::vector<uint16_t> last_nack_list_; 97 std::vector<uint16_t> last_nack_list_;
99 }; 98 };
100 99
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests); 549 EXPECT_EQ(6U, receiver_.RtcpSent().unique_nack_requests);
551 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21)); 550 EXPECT_THAT(receiver_.LastNackListSent(), ElementsAre(11, 18, 20, 21));
552 551
553 // Send module receives the request. 552 // Send module receives the request.
554 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets); 553 EXPECT_EQ(2U, sender_.RtcpReceived().nack_packets);
555 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests); 554 EXPECT_EQ(8U, sender_.RtcpReceived().nack_requests);
556 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests); 555 EXPECT_EQ(6U, sender_.RtcpReceived().unique_nack_requests);
557 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent()); 556 EXPECT_EQ(75, sender_.RtcpReceived().UniqueNackRequestsInPercent());
558 } 557 }
559 } // namespace webrtc 558 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698