OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 Random generator(0x256F8A285EC829ull); | 45 Random generator(0x256F8A285EC829ull); |
46 for (size_t i = 0; i < kBufferLength; ++i) | 46 for (size_t i = 0; i < kBufferLength; ++i) |
47 buffer[i] = static_cast<uint8_t>(generator.Rand(0, 0xff)); | 47 buffer[i] = static_cast<uint8_t>(generator.Rand(0, 0xff)); |
48 | 48 |
49 ReportBlock rb; | 49 ReportBlock rb; |
50 EXPECT_TRUE(rb.Parse(buffer, kBufferLength)); | 50 EXPECT_TRUE(rb.Parse(buffer, kBufferLength)); |
51 } | 51 } |
52 | 52 |
53 TEST(RtcpPacketReportBlockTest, ParseMatchCreate) { | 53 TEST(RtcpPacketReportBlockTest, ParseMatchCreate) { |
54 ReportBlock rb; | 54 ReportBlock rb; |
55 rb.To(kRemoteSsrc); | 55 rb.SetMediaSsrc(kRemoteSsrc); |
56 rb.WithFractionLost(kFractionLost); | 56 rb.SetFractionLost(kFractionLost); |
57 rb.WithCumulativeLost(kCumulativeLost); | 57 rb.SetCumulativeLost(kCumulativeLost); |
58 rb.WithExtHighestSeqNum(kExtHighestSeqNum); | 58 rb.SetExtHighestSeqNum(kExtHighestSeqNum); |
59 rb.WithJitter(kJitter); | 59 rb.SetJitter(kJitter); |
60 rb.WithLastSr(kLastSr); | 60 rb.SetLastSr(kLastSr); |
61 rb.WithDelayLastSr(kDelayLastSr); | 61 rb.SetDelayLastSr(kDelayLastSr); |
62 | 62 |
63 uint8_t buffer[kBufferLength]; | 63 uint8_t buffer[kBufferLength]; |
64 rb.Create(buffer); | 64 rb.Create(buffer); |
65 | 65 |
66 ReportBlock parsed; | 66 ReportBlock parsed; |
67 EXPECT_TRUE(parsed.Parse(buffer, kBufferLength)); | 67 EXPECT_TRUE(parsed.Parse(buffer, kBufferLength)); |
68 | 68 |
69 EXPECT_EQ(kRemoteSsrc, parsed.source_ssrc()); | 69 EXPECT_EQ(kRemoteSsrc, parsed.source_ssrc()); |
70 EXPECT_EQ(kFractionLost, parsed.fraction_lost()); | 70 EXPECT_EQ(kFractionLost, parsed.fraction_lost()); |
71 EXPECT_EQ(kCumulativeLost, parsed.cumulative_lost()); | 71 EXPECT_EQ(kCumulativeLost, parsed.cumulative_lost()); |
72 EXPECT_EQ(kExtHighestSeqNum, parsed.extended_high_seq_num()); | 72 EXPECT_EQ(kExtHighestSeqNum, parsed.extended_high_seq_num()); |
73 EXPECT_EQ(kJitter, parsed.jitter()); | 73 EXPECT_EQ(kJitter, parsed.jitter()); |
74 EXPECT_EQ(kLastSr, parsed.last_sr()); | 74 EXPECT_EQ(kLastSr, parsed.last_sr()); |
75 EXPECT_EQ(kDelayLastSr, parsed.delay_since_last_sr()); | 75 EXPECT_EQ(kDelayLastSr, parsed.delay_since_last_sr()); |
76 } | 76 } |
77 | 77 |
78 TEST(RtcpPacketReportBlockTest, ValidateCumulativeLost) { | 78 TEST(RtcpPacketReportBlockTest, ValidateCumulativeLost) { |
79 const uint32_t kMaxCumulativeLost = 0xffffff; | 79 const uint32_t kMaxCumulativeLost = 0xffffff; |
80 ReportBlock rb; | 80 ReportBlock rb; |
81 EXPECT_FALSE(rb.WithCumulativeLost(kMaxCumulativeLost + 1)); | 81 EXPECT_FALSE(rb.SetCumulativeLost(kMaxCumulativeLost + 1)); |
82 EXPECT_TRUE(rb.WithCumulativeLost(kMaxCumulativeLost)); | 82 EXPECT_TRUE(rb.SetCumulativeLost(kMaxCumulativeLost)); |
83 } | 83 } |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 } // namespace webrtc | 86 } // namespace webrtc |
OLD | NEW |