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

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

Issue 1452733002: rtcp::VoipMetric block moved into own file and got Parse function (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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.
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 EXPECT_EQ(2, parser.dlrr_items()->num_packets()); 915 EXPECT_EQ(2, parser.dlrr_items()->num_packets());
916 EXPECT_EQ(0x11111111U, parser.dlrr_items()->Ssrc(0)); 916 EXPECT_EQ(0x11111111U, parser.dlrr_items()->Ssrc(0));
917 EXPECT_EQ(0x22222222U, parser.dlrr_items()->LastRr(0)); 917 EXPECT_EQ(0x22222222U, parser.dlrr_items()->LastRr(0));
918 EXPECT_EQ(0x33333333U, parser.dlrr_items()->DelayLastRr(0)); 918 EXPECT_EQ(0x33333333U, parser.dlrr_items()->DelayLastRr(0));
919 EXPECT_EQ(0x44444444U, parser.dlrr_items()->Ssrc(1)); 919 EXPECT_EQ(0x44444444U, parser.dlrr_items()->Ssrc(1));
920 EXPECT_EQ(0x55555555U, parser.dlrr_items()->LastRr(1)); 920 EXPECT_EQ(0x55555555U, parser.dlrr_items()->LastRr(1));
921 EXPECT_EQ(0x66666666U, parser.dlrr_items()->DelayLastRr(1)); 921 EXPECT_EQ(0x66666666U, parser.dlrr_items()->DelayLastRr(1));
922 } 922 }
923 923
924 TEST(RtcpPacketTest, XrWithVoipMetric) { 924 TEST(RtcpPacketTest, XrWithVoipMetric) {
925 VoipMetric metric; 925 RTCPVoIPMetric metric;
926 metric.To(kRemoteSsrc); 926 metric.lossRate = 1;
927 metric.LossRate(1); 927 metric.discardRate = 2;
928 metric.DiscardRate(2); 928 metric.burstDensity = 3;
929 metric.BurstDensity(3); 929 metric.gapDensity = 4;
930 metric.GapDensity(4); 930 metric.burstDuration = 0x1111;
931 metric.BurstDuration(0x1111); 931 metric.gapDuration = 0x2222;
932 metric.GapDuration(0x2222); 932 metric.roundTripDelay = 0x3333;
933 metric.RoundTripDelay(0x3333); 933 metric.endSystemDelay = 0x4444;
934 metric.EndSystemDelay(0x4444); 934 metric.signalLevel = 5;
935 metric.SignalLevel(5); 935 metric.noiseLevel = 6;
936 metric.NoiseLevel(6); 936 metric.RERL = 7;
937 metric.Rerl(7); 937 metric.Gmin = 8;
938 metric.Gmin(8); 938 metric.Rfactor = 9;
939 metric.Rfactor(9); 939 metric.extRfactor = 10;
940 metric.ExtRfactor(10); 940 metric.MOSLQ = 11;
941 metric.MosLq(11); 941 metric.MOSCQ = 12;
942 metric.MosCq(12); 942 metric.RXconfig = 13;
943 metric.RxConfig(13); 943 metric.JBnominal = 0x5555;
944 metric.JbNominal(0x5555); 944 metric.JBmax = 0x6666;
945 metric.JbMax(0x6666); 945 metric.JBabsMax = 0x7777;
946 metric.JbAbsMax(0x7777); 946 VoipMetric metric_block;
947 947 metric_block.To(kRemoteSsrc);
948 metric_block.WithVoipMetric(metric);
948 Xr xr; 949 Xr xr;
949 xr.From(kSenderSsrc); 950 xr.From(kSenderSsrc);
950 EXPECT_TRUE(xr.WithVoipMetric(&metric)); 951 EXPECT_TRUE(xr.WithVoipMetric(&metric_block));
951 952
952 rtc::scoped_ptr<RawPacket> packet(xr.Build()); 953 rtc::scoped_ptr<RawPacket> packet(xr.Build());
953 RtcpPacketParser parser; 954 RtcpPacketParser parser;
954 parser.Parse(packet->Buffer(), packet->Length()); 955 parser.Parse(packet->Buffer(), packet->Length());
955 EXPECT_EQ(1, parser.xr_header()->num_packets()); 956 EXPECT_EQ(1, parser.xr_header()->num_packets());
956 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); 957 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc());
957 EXPECT_EQ(1, parser.voip_metric()->num_packets()); 958 EXPECT_EQ(1, parser.voip_metric()->num_packets());
958 EXPECT_EQ(kRemoteSsrc, parser.voip_metric()->Ssrc()); 959 EXPECT_EQ(kRemoteSsrc, parser.voip_metric()->Ssrc());
959 EXPECT_EQ(1, parser.voip_metric()->LossRate()); 960 EXPECT_EQ(1, parser.voip_metric()->LossRate());
960 EXPECT_EQ(2, parser.voip_metric()->DiscardRate()); 961 EXPECT_EQ(2, parser.voip_metric()->DiscardRate());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 EXPECT_TRUE(xr.WithDlrr(&dlrr)); 1035 EXPECT_TRUE(xr.WithDlrr(&dlrr));
1035 EXPECT_FALSE(xr.WithDlrr(&dlrr)); 1036 EXPECT_FALSE(xr.WithDlrr(&dlrr));
1036 1037
1037 VoipMetric voip_metric; 1038 VoipMetric voip_metric;
1038 for (int i = 0; i < kMaxBlocks; ++i) 1039 for (int i = 0; i < kMaxBlocks; ++i)
1039 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); 1040 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric));
1040 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); 1041 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric));
1041 } 1042 }
1042 1043
1043 } // namespace webrtc 1044 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698