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

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

Issue 1446513002: rtcp::Pli moved into own file and got a Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merged with master Created 5 years 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.
11 */ 11 */
12 12
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" 16 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
19 #include "webrtc/test/rtcp_packet_parser.h" 19 #include "webrtc/test/rtcp_packet_parser.h"
20 20
21 using ::testing::ElementsAre; 21 using ::testing::ElementsAre;
22 22
23 using webrtc::rtcp::App; 23 using webrtc::rtcp::App;
24 using webrtc::rtcp::Bye; 24 using webrtc::rtcp::Bye;
25 using webrtc::rtcp::Dlrr; 25 using webrtc::rtcp::Dlrr;
26 using webrtc::rtcp::Empty; 26 using webrtc::rtcp::Empty;
27 using webrtc::rtcp::Fir; 27 using webrtc::rtcp::Fir;
28 using webrtc::rtcp::Nack; 28 using webrtc::rtcp::Nack;
29 using webrtc::rtcp::Pli;
30 using webrtc::rtcp::Sdes; 29 using webrtc::rtcp::Sdes;
31 using webrtc::rtcp::SenderReport; 30 using webrtc::rtcp::SenderReport;
32 using webrtc::rtcp::Sli; 31 using webrtc::rtcp::Sli;
33 using webrtc::rtcp::RawPacket; 32 using webrtc::rtcp::RawPacket;
34 using webrtc::rtcp::ReceiverReport; 33 using webrtc::rtcp::ReceiverReport;
35 using webrtc::rtcp::Remb; 34 using webrtc::rtcp::Remb;
36 using webrtc::rtcp::ReportBlock; 35 using webrtc::rtcp::ReportBlock;
37 using webrtc::rtcp::Rpsi; 36 using webrtc::rtcp::Rpsi;
38 using webrtc::rtcp::Rrtr; 37 using webrtc::rtcp::Rrtr;
39 using webrtc::rtcp::SenderReport; 38 using webrtc::rtcp::SenderReport;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 288
290 rtc::scoped_ptr<RawPacket> packet(sdes.Build()); 289 rtc::scoped_ptr<RawPacket> packet(sdes.Build());
291 RtcpPacketParser parser; 290 RtcpPacketParser parser;
292 parser.Parse(packet->Buffer(), packet->Length()); 291 parser.Parse(packet->Buffer(), packet->Length());
293 EXPECT_EQ(1, parser.sdes()->num_packets()); 292 EXPECT_EQ(1, parser.sdes()->num_packets());
294 EXPECT_EQ(1, parser.sdes_chunk()->num_packets()); 293 EXPECT_EQ(1, parser.sdes_chunk()->num_packets());
295 EXPECT_EQ(kSenderSsrc, parser.sdes_chunk()->Ssrc()); 294 EXPECT_EQ(kSenderSsrc, parser.sdes_chunk()->Ssrc());
296 EXPECT_EQ("", parser.sdes_chunk()->Cname()); 295 EXPECT_EQ("", parser.sdes_chunk()->Cname());
297 } 296 }
298 297
299 TEST(RtcpPacketTest, Pli) {
300 Pli pli;
301 pli.From(kSenderSsrc);
302 pli.To(kRemoteSsrc);
303
304 rtc::scoped_ptr<RawPacket> packet(pli.Build());
305 RtcpPacketParser parser;
306 parser.Parse(packet->Buffer(), packet->Length());
307 EXPECT_EQ(1, parser.pli()->num_packets());
308 EXPECT_EQ(kSenderSsrc, parser.pli()->Ssrc());
309 EXPECT_EQ(kRemoteSsrc, parser.pli()->MediaSsrc());
310 }
311
312 TEST(RtcpPacketTest, Sli) { 298 TEST(RtcpPacketTest, Sli) {
313 const uint16_t kFirstMb = 7777; 299 const uint16_t kFirstMb = 7777;
314 const uint16_t kNumberOfMb = 6666; 300 const uint16_t kNumberOfMb = 6666;
315 const uint8_t kPictureId = 60; 301 const uint8_t kPictureId = 60;
316 Sli sli; 302 Sli sli;
317 sli.From(kSenderSsrc); 303 sli.From(kSenderSsrc);
318 sli.To(kRemoteSsrc); 304 sli.To(kRemoteSsrc);
319 sli.WithFirstMb(kFirstMb); 305 sli.WithFirstMb(kFirstMb);
320 sli.WithNumberOfMb(kNumberOfMb); 306 sli.WithNumberOfMb(kNumberOfMb);
321 sli.WithPictureId(kPictureId); 307 sli.WithPictureId(kPictureId);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 EXPECT_TRUE(xr.WithDlrr(&dlrr)); 985 EXPECT_TRUE(xr.WithDlrr(&dlrr));
1000 EXPECT_FALSE(xr.WithDlrr(&dlrr)); 986 EXPECT_FALSE(xr.WithDlrr(&dlrr));
1001 987
1002 VoipMetric voip_metric; 988 VoipMetric voip_metric;
1003 for (int i = 0; i < kMaxBlocks; ++i) 989 for (int i = 0; i < kMaxBlocks; ++i)
1004 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); 990 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric));
1005 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); 991 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric));
1006 } 992 }
1007 993
1008 } // namespace webrtc 994 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698