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

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

Issue 1551893002: [rtp_rtcp] rtcp::Sli packet moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 * This file includes unit tests for the RtcpPacket. 10 * This file includes unit tests for the RtcpPacket.
(...skipping 16 matching lines...) Expand all
27 using webrtc::rtcp::Empty; 27 using webrtc::rtcp::Empty;
28 using webrtc::rtcp::Fir; 28 using webrtc::rtcp::Fir;
29 using webrtc::rtcp::RawPacket; 29 using webrtc::rtcp::RawPacket;
30 using webrtc::rtcp::ReceiverReport; 30 using webrtc::rtcp::ReceiverReport;
31 using webrtc::rtcp::Remb; 31 using webrtc::rtcp::Remb;
32 using webrtc::rtcp::ReportBlock; 32 using webrtc::rtcp::ReportBlock;
33 using webrtc::rtcp::Rpsi; 33 using webrtc::rtcp::Rpsi;
34 using webrtc::rtcp::Rrtr; 34 using webrtc::rtcp::Rrtr;
35 using webrtc::rtcp::Sdes; 35 using webrtc::rtcp::Sdes;
36 using webrtc::rtcp::SenderReport; 36 using webrtc::rtcp::SenderReport;
37 using webrtc::rtcp::Sli;
38 using webrtc::rtcp::Tmmbn; 37 using webrtc::rtcp::Tmmbn;
39 using webrtc::rtcp::Tmmbr; 38 using webrtc::rtcp::Tmmbr;
40 using webrtc::rtcp::VoipMetric; 39 using webrtc::rtcp::VoipMetric;
41 using webrtc::rtcp::Xr; 40 using webrtc::rtcp::Xr;
42 using webrtc::test::RtcpPacketParser; 41 using webrtc::test::RtcpPacketParser;
43 42
44 namespace webrtc { 43 namespace webrtc {
45 44
46 const uint32_t kSenderSsrc = 0x12345678; 45 const uint32_t kSenderSsrc = 0x12345678;
47 const uint32_t kRemoteSsrc = 0x23456789; 46 const uint32_t kRemoteSsrc = 0x23456789;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 211
213 rtc::scoped_ptr<RawPacket> packet(sdes.Build()); 212 rtc::scoped_ptr<RawPacket> packet(sdes.Build());
214 RtcpPacketParser parser; 213 RtcpPacketParser parser;
215 parser.Parse(packet->Buffer(), packet->Length()); 214 parser.Parse(packet->Buffer(), packet->Length());
216 EXPECT_EQ(1, parser.sdes()->num_packets()); 215 EXPECT_EQ(1, parser.sdes()->num_packets());
217 EXPECT_EQ(1, parser.sdes_chunk()->num_packets()); 216 EXPECT_EQ(1, parser.sdes_chunk()->num_packets());
218 EXPECT_EQ(kSenderSsrc, parser.sdes_chunk()->Ssrc()); 217 EXPECT_EQ(kSenderSsrc, parser.sdes_chunk()->Ssrc());
219 EXPECT_EQ("", parser.sdes_chunk()->Cname()); 218 EXPECT_EQ("", parser.sdes_chunk()->Cname());
220 } 219 }
221 220
222 TEST(RtcpPacketTest, Sli) {
223 const uint16_t kFirstMb = 7777;
224 const uint16_t kNumberOfMb = 6666;
225 const uint8_t kPictureId = 60;
226 Sli sli;
227 sli.From(kSenderSsrc);
228 sli.To(kRemoteSsrc);
229 sli.WithFirstMb(kFirstMb);
230 sli.WithNumberOfMb(kNumberOfMb);
231 sli.WithPictureId(kPictureId);
232
233 rtc::scoped_ptr<RawPacket> packet(sli.Build());
234 RtcpPacketParser parser;
235 parser.Parse(packet->Buffer(), packet->Length());
236 EXPECT_EQ(1, parser.sli()->num_packets());
237 EXPECT_EQ(kSenderSsrc, parser.sli()->Ssrc());
238 EXPECT_EQ(kRemoteSsrc, parser.sli()->MediaSsrc());
239 EXPECT_EQ(1, parser.sli_item()->num_packets());
240 EXPECT_EQ(kFirstMb, parser.sli_item()->FirstMb());
241 EXPECT_EQ(kNumberOfMb, parser.sli_item()->NumberOfMb());
242 EXPECT_EQ(kPictureId, parser.sli_item()->PictureId());
243 }
244
245 TEST(RtcpPacketTest, Rpsi) { 221 TEST(RtcpPacketTest, Rpsi) {
246 Rpsi rpsi; 222 Rpsi rpsi;
247 // 1000001 (7 bits = 1 byte in native string). 223 // 1000001 (7 bits = 1 byte in native string).
248 const uint64_t kPictureId = 0x41; 224 const uint64_t kPictureId = 0x41;
249 const uint16_t kNumberOfValidBytes = 1; 225 const uint16_t kNumberOfValidBytes = 1;
250 rpsi.WithPayloadType(100); 226 rpsi.WithPayloadType(100);
251 rpsi.WithPictureId(kPictureId); 227 rpsi.WithPictureId(kPictureId);
252 228
253 rtc::scoped_ptr<RawPacket> packet(rpsi.Build()); 229 rtc::scoped_ptr<RawPacket> packet(rpsi.Build());
254 RtcpPacketParser parser; 230 RtcpPacketParser parser;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 EXPECT_TRUE(xr.WithDlrr(&dlrr)); 785 EXPECT_TRUE(xr.WithDlrr(&dlrr));
810 EXPECT_FALSE(xr.WithDlrr(&dlrr)); 786 EXPECT_FALSE(xr.WithDlrr(&dlrr));
811 787
812 VoipMetric voip_metric; 788 VoipMetric voip_metric;
813 for (int i = 0; i < kMaxBlocks; ++i) 789 for (int i = 0; i < kMaxBlocks; ++i)
814 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); 790 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric));
815 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); 791 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric));
816 } 792 }
817 793
818 } // namespace webrtc 794 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698