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

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

Issue 2516983004: Move ownership of PacketRouter from CongestionController to Call. (Closed)
Patch Set: Add back packet_router method and 4-argument constructor. Created 4 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) 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 15 matching lines...) Expand all
26 uint32_t bitrate) override {} 26 uint32_t bitrate) override {}
27 }; 27 };
28 28
29 void FuzzOneInput(const uint8_t* data, size_t size) { 29 void FuzzOneInput(const uint8_t* data, size_t size) {
30 size_t i = 0; 30 size_t i = 0;
31 if (size < sizeof(int64_t) + sizeof(uint8_t) + sizeof(uint32_t)) 31 if (size < sizeof(int64_t) + sizeof(uint8_t) + sizeof(uint32_t))
32 return; 32 return;
33 SimulatedClock clock(data[i++]); 33 SimulatedClock clock(data[i++]);
34 NullBitrateObserver observer; 34 NullBitrateObserver observer;
35 RtcEventLogNullImpl event_log; 35 RtcEventLogNullImpl event_log;
36 CongestionController cc(&clock, &observer, &observer, &event_log); 36 PacketRouter packet_router;
37 CongestionController cc(&clock, &observer, &observer, &event_log,
38 &packet_router);
37 RemoteBitrateEstimator* rbe = cc.GetRemoteBitrateEstimator(true); 39 RemoteBitrateEstimator* rbe = cc.GetRemoteBitrateEstimator(true);
38 RTPHeader header; 40 RTPHeader header;
39 header.ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[i]); 41 header.ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[i]);
40 i += sizeof(uint32_t); 42 i += sizeof(uint32_t);
41 header.extension.hasTransportSequenceNumber = true; 43 header.extension.hasTransportSequenceNumber = true;
42 int64_t arrival_time_ms = 44 int64_t arrival_time_ms =
43 std::max<int64_t>(ByteReader<int64_t>::ReadBigEndian(&data[i]), 0); 45 std::max<int64_t>(ByteReader<int64_t>::ReadBigEndian(&data[i]), 0);
44 i += sizeof(int64_t); 46 i += sizeof(int64_t);
45 const size_t kMinPacketSize = 47 const size_t kMinPacketSize =
46 sizeof(size_t) + sizeof(uint16_t) + sizeof(uint8_t); 48 sizeof(size_t) + sizeof(uint16_t) + sizeof(uint8_t);
47 while (i + kMinPacketSize < size) { 49 while (i + kMinPacketSize < size) {
48 size_t payload_size = ByteReader<size_t>::ReadBigEndian(&data[i]) % 1500; 50 size_t payload_size = ByteReader<size_t>::ReadBigEndian(&data[i]) % 1500;
49 i += sizeof(size_t); 51 i += sizeof(size_t);
50 header.extension.transportSequenceNumber = 52 header.extension.transportSequenceNumber =
51 ByteReader<uint16_t>::ReadBigEndian(&data[i]); 53 ByteReader<uint16_t>::ReadBigEndian(&data[i]);
52 i += sizeof(uint16_t); 54 i += sizeof(uint16_t);
53 rbe->IncomingPacket(arrival_time_ms, payload_size, header); 55 rbe->IncomingPacket(arrival_time_ms, payload_size, header);
54 clock.AdvanceTimeMilliseconds(5); 56 clock.AdvanceTimeMilliseconds(5);
55 arrival_time_ms += ByteReader<uint8_t>::ReadBigEndian(&data[i]); 57 arrival_time_ms += ByteReader<uint8_t>::ReadBigEndian(&data[i]);
56 arrival_time_ms += sizeof(uint8_t); 58 arrival_time_ms += sizeof(uint8_t);
57 } 59 }
58 rbe->Process(); 60 rbe->Process();
59 } 61 }
60 } // namespace webrtc 62 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698