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

Side by Side Diff: webrtc/test/fuzzers/neteq_rtp_fuzzer.cc

Issue 2809153002: Change from WebRtcRTPHeader to RTPHeader in NetEq tests and tools (Closed)
Patch Set: Fixing neteq_rtp_fuzzer Created 3 years, 8 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 FuzzHeader(); 80 FuzzHeader();
81 return packet_to_return; 81 return packet_to_return;
82 } 82 }
83 83
84 void AdvanceOutputEvent() override { return input_->AdvanceOutputEvent(); } 84 void AdvanceOutputEvent() override { return input_->AdvanceOutputEvent(); }
85 85
86 bool ended() const override { return ended_; } 86 bool ended() const override { return ended_; }
87 87
88 rtc::Optional<RTPHeader> NextHeader() const override { 88 rtc::Optional<RTPHeader> NextHeader() const override {
89 RTC_DCHECK(packet_); 89 RTC_DCHECK(packet_);
90 return rtc::Optional<RTPHeader>(packet_->header.header); 90 return rtc::Optional<RTPHeader>(packet_->header);
91 } 91 }
92 92
93 private: 93 private:
94 void FuzzHeader() { 94 void FuzzHeader() {
95 constexpr size_t kNumBytesToFuzz = 11; 95 constexpr size_t kNumBytesToFuzz = 11;
96 if (data_ix_ + kNumBytesToFuzz > data_.size()) { 96 if (data_ix_ + kNumBytesToFuzz > data_.size()) {
97 ended_ = true; 97 ended_ = true;
98 return; 98 return;
99 } 99 }
100 RTC_DCHECK(packet_); 100 RTC_DCHECK(packet_);
101 const size_t start_ix = data_ix_; 101 const size_t start_ix = data_ix_;
102 packet_->header.header.payloadType = 102 packet_->header.payloadType =
103 ByteReader<uint8_t>::ReadLittleEndian(&data_[data_ix_]); 103 ByteReader<uint8_t>::ReadLittleEndian(&data_[data_ix_]);
104 packet_->header.header.payloadType &= 0x7F; 104 packet_->header.payloadType &= 0x7F;
105 data_ix_ += sizeof(uint8_t); 105 data_ix_ += sizeof(uint8_t);
106 packet_->header.header.sequenceNumber = 106 packet_->header.sequenceNumber =
107 ByteReader<uint16_t>::ReadLittleEndian(&data_[data_ix_]); 107 ByteReader<uint16_t>::ReadLittleEndian(&data_[data_ix_]);
108 data_ix_ += sizeof(uint16_t); 108 data_ix_ += sizeof(uint16_t);
109 packet_->header.header.timestamp = 109 packet_->header.timestamp =
110 ByteReader<uint32_t>::ReadLittleEndian(&data_[data_ix_]); 110 ByteReader<uint32_t>::ReadLittleEndian(&data_[data_ix_]);
111 data_ix_ += sizeof(uint32_t); 111 data_ix_ += sizeof(uint32_t);
112 packet_->header.header.ssrc = 112 packet_->header.ssrc =
113 ByteReader<uint32_t>::ReadLittleEndian(&data_[data_ix_]); 113 ByteReader<uint32_t>::ReadLittleEndian(&data_[data_ix_]);
114 data_ix_ += sizeof(uint32_t); 114 data_ix_ += sizeof(uint32_t);
115 RTC_CHECK_EQ(data_ix_ - start_ix, kNumBytesToFuzz); 115 RTC_CHECK_EQ(data_ix_ - start_ix, kNumBytesToFuzz);
116 } 116 }
117 117
118 bool ended_ = false; 118 bool ended_ = false;
119 rtc::ArrayView<const uint8_t> data_; 119 rtc::ArrayView<const uint8_t> data_;
120 size_t data_ix_ = 0; 120 size_t data_ix_ = 0;
121 std::unique_ptr<EncodeNetEqInput> input_; 121 std::unique_ptr<EncodeNetEqInput> input_;
122 std::unique_ptr<PacketData> packet_; 122 std::unique_ptr<PacketData> packet_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 test.Run(); 159 test.Run();
160 } 160 }
161 161
162 } // namespace test 162 } // namespace test
163 163
164 void FuzzOneInput(const uint8_t* data, size_t size) { 164 void FuzzOneInput(const uint8_t* data, size_t size) {
165 test::FuzzOneInputTest(data, size); 165 test::FuzzOneInputTest(data, size);
166 } 166 }
167 167
168 } // namespace webrtc 168 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/tools/rtp_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698