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

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: rebase 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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 EXPECT_EQ(2, parser.dlrr_items()->num_packets()); 788 EXPECT_EQ(2, parser.dlrr_items()->num_packets());
789 EXPECT_EQ(0x11111111U, parser.dlrr_items()->Ssrc(0)); 789 EXPECT_EQ(0x11111111U, parser.dlrr_items()->Ssrc(0));
790 EXPECT_EQ(0x22222222U, parser.dlrr_items()->LastRr(0)); 790 EXPECT_EQ(0x22222222U, parser.dlrr_items()->LastRr(0));
791 EXPECT_EQ(0x33333333U, parser.dlrr_items()->DelayLastRr(0)); 791 EXPECT_EQ(0x33333333U, parser.dlrr_items()->DelayLastRr(0));
792 EXPECT_EQ(0x44444444U, parser.dlrr_items()->Ssrc(1)); 792 EXPECT_EQ(0x44444444U, parser.dlrr_items()->Ssrc(1));
793 EXPECT_EQ(0x55555555U, parser.dlrr_items()->LastRr(1)); 793 EXPECT_EQ(0x55555555U, parser.dlrr_items()->LastRr(1));
794 EXPECT_EQ(0x66666666U, parser.dlrr_items()->DelayLastRr(1)); 794 EXPECT_EQ(0x66666666U, parser.dlrr_items()->DelayLastRr(1));
795 } 795 }
796 796
797 TEST(RtcpPacketTest, XrWithVoipMetric) { 797 TEST(RtcpPacketTest, XrWithVoipMetric) {
798 VoipMetric metric; 798 RTCPVoIPMetric metric;
799 metric.To(kRemoteSsrc); 799 metric.lossRate = 1;
800 metric.LossRate(1); 800 metric.discardRate = 2;
801 metric.DiscardRate(2); 801 metric.burstDensity = 3;
802 metric.BurstDensity(3); 802 metric.gapDensity = 4;
803 metric.GapDensity(4); 803 metric.burstDuration = 0x1111;
804 metric.BurstDuration(0x1111); 804 metric.gapDuration = 0x2222;
805 metric.GapDuration(0x2222); 805 metric.roundTripDelay = 0x3333;
806 metric.RoundTripDelay(0x3333); 806 metric.endSystemDelay = 0x4444;
807 metric.EndSystemDelay(0x4444); 807 metric.signalLevel = 5;
808 metric.SignalLevel(5); 808 metric.noiseLevel = 6;
809 metric.NoiseLevel(6); 809 metric.RERL = 7;
810 metric.Rerl(7); 810 metric.Gmin = 8;
811 metric.Gmin(8); 811 metric.Rfactor = 9;
812 metric.Rfactor(9); 812 metric.extRfactor = 10;
813 metric.ExtRfactor(10); 813 metric.MOSLQ = 11;
814 metric.MosLq(11); 814 metric.MOSCQ = 12;
815 metric.MosCq(12); 815 metric.RXconfig = 13;
816 metric.RxConfig(13); 816 metric.JBnominal = 0x5555;
817 metric.JbNominal(0x5555); 817 metric.JBmax = 0x6666;
818 metric.JbMax(0x6666); 818 metric.JBabsMax = 0x7777;
819 metric.JbAbsMax(0x7777); 819 VoipMetric metric_block;
820 820 metric_block.To(kRemoteSsrc);
821 metric_block.WithVoipMetric(metric);
821 Xr xr; 822 Xr xr;
822 xr.From(kSenderSsrc); 823 xr.From(kSenderSsrc);
823 EXPECT_TRUE(xr.WithVoipMetric(&metric)); 824 EXPECT_TRUE(xr.WithVoipMetric(&metric_block));
824 825
825 rtc::scoped_ptr<RawPacket> packet(xr.Build()); 826 rtc::scoped_ptr<RawPacket> packet(xr.Build());
826 RtcpPacketParser parser; 827 RtcpPacketParser parser;
827 parser.Parse(packet->Buffer(), packet->Length()); 828 parser.Parse(packet->Buffer(), packet->Length());
828 EXPECT_EQ(1, parser.xr_header()->num_packets()); 829 EXPECT_EQ(1, parser.xr_header()->num_packets());
829 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc()); 830 EXPECT_EQ(kSenderSsrc, parser.xr_header()->Ssrc());
830 EXPECT_EQ(1, parser.voip_metric()->num_packets()); 831 EXPECT_EQ(1, parser.voip_metric()->num_packets());
831 EXPECT_EQ(kRemoteSsrc, parser.voip_metric()->Ssrc()); 832 EXPECT_EQ(kRemoteSsrc, parser.voip_metric()->Ssrc());
832 EXPECT_EQ(1, parser.voip_metric()->LossRate()); 833 EXPECT_EQ(1, parser.voip_metric()->LossRate());
833 EXPECT_EQ(2, parser.voip_metric()->DiscardRate()); 834 EXPECT_EQ(2, parser.voip_metric()->DiscardRate());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 EXPECT_TRUE(xr.WithDlrr(&dlrr)); 908 EXPECT_TRUE(xr.WithDlrr(&dlrr));
908 EXPECT_FALSE(xr.WithDlrr(&dlrr)); 909 EXPECT_FALSE(xr.WithDlrr(&dlrr));
909 910
910 VoipMetric voip_metric; 911 VoipMetric voip_metric;
911 for (int i = 0; i < kMaxBlocks; ++i) 912 for (int i = 0; i < kMaxBlocks; ++i)
912 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric)); 913 EXPECT_TRUE(xr.WithVoipMetric(&voip_metric));
913 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric)); 914 EXPECT_FALSE(xr.WithVoipMetric(&voip_metric));
914 } 915 }
915 916
916 } // namespace webrtc 917 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698