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

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

Issue 2380683005: Moved RtcEventLog files from call/ to logging/ (new top level dir) (Closed)
Patch Set: Updated GYP files Created 4 years, 2 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
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
11 #include "webrtc/call/rtc_event_log.h"
12 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 11 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
13 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" 12 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h"
14 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 13 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
15 14
16 namespace webrtc { 15 namespace webrtc {
17 16
18 class NullBitrateObserver : public CongestionController::Observer, 17 class NullBitrateObserver : public CongestionController::Observer,
19 public RemoteBitrateObserver { 18 public RemoteBitrateObserver {
20 public: 19 public:
21 ~NullBitrateObserver() override {} 20 ~NullBitrateObserver() override {}
22 void OnNetworkChanged(uint32_t bitrate_bps, 21 void OnNetworkChanged(uint32_t bitrate_bps,
23 uint8_t fraction_loss, 22 uint8_t fraction_loss,
24 int64_t rtt_ms) override {} 23 int64_t rtt_ms) override {}
25 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, 24 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
26 uint32_t bitrate) override {} 25 uint32_t bitrate) override {}
27 }; 26 };
28 27
29 void FuzzOneInput(const uint8_t* data, size_t size) { 28 void FuzzOneInput(const uint8_t* data, size_t size) {
30 size_t i = 0; 29 size_t i = 0;
31 if (size < sizeof(int64_t) + sizeof(uint8_t) + sizeof(uint32_t)) 30 if (size < sizeof(int64_t) + sizeof(uint8_t) + sizeof(uint32_t))
32 return; 31 return;
33 SimulatedClock clock(data[i++]); 32 SimulatedClock clock(data[i++]);
34 NullBitrateObserver observer; 33 NullBitrateObserver observer;
35 RtcEventLogNullImpl event_log; 34 CongestionController cc(&clock, &observer, &observer, nullptr);
the sun 2016/09/30 09:40:08 Uhm, can we leave the null object discussion in th
skvlad 2016/09/30 18:50:55 Sorry, this wasn't intentional :) I'm working on 3
36 CongestionController cc(&clock, &observer, &observer, &event_log);
37 RemoteBitrateEstimator* rbe = cc.GetRemoteBitrateEstimator(true); 35 RemoteBitrateEstimator* rbe = cc.GetRemoteBitrateEstimator(true);
38 RTPHeader header; 36 RTPHeader header;
39 header.ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[i]); 37 header.ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[i]);
40 i += sizeof(uint32_t); 38 i += sizeof(uint32_t);
41 header.extension.hasTransportSequenceNumber = true; 39 header.extension.hasTransportSequenceNumber = true;
42 int64_t arrival_time_ms = 40 int64_t arrival_time_ms =
43 std::max<int64_t>(ByteReader<int64_t>::ReadBigEndian(&data[i]), 0); 41 std::max<int64_t>(ByteReader<int64_t>::ReadBigEndian(&data[i]), 0);
44 i += sizeof(int64_t); 42 i += sizeof(int64_t);
45 const size_t kMinPacketSize = 43 const size_t kMinPacketSize =
46 sizeof(size_t) + sizeof(uint16_t) + sizeof(uint8_t); 44 sizeof(size_t) + sizeof(uint16_t) + sizeof(uint8_t);
47 while (i + kMinPacketSize < size) { 45 while (i + kMinPacketSize < size) {
48 size_t payload_size = ByteReader<size_t>::ReadBigEndian(&data[i]) % 1500; 46 size_t payload_size = ByteReader<size_t>::ReadBigEndian(&data[i]) % 1500;
49 i += sizeof(size_t); 47 i += sizeof(size_t);
50 header.extension.transportSequenceNumber = 48 header.extension.transportSequenceNumber =
51 ByteReader<uint16_t>::ReadBigEndian(&data[i]); 49 ByteReader<uint16_t>::ReadBigEndian(&data[i]);
52 i += sizeof(uint16_t); 50 i += sizeof(uint16_t);
53 rbe->IncomingPacket(arrival_time_ms, payload_size, header); 51 rbe->IncomingPacket(arrival_time_ms, payload_size, header);
54 clock.AdvanceTimeMilliseconds(5); 52 clock.AdvanceTimeMilliseconds(5);
55 arrival_time_ms += ByteReader<uint8_t>::ReadBigEndian(&data[i]); 53 arrival_time_ms += ByteReader<uint8_t>::ReadBigEndian(&data[i]);
56 arrival_time_ms += sizeof(uint8_t); 54 arrival_time_ms += sizeof(uint8_t);
57 } 55 }
58 rbe->Process(); 56 rbe->Process();
59 } 57 }
60 } // namespace webrtc 58 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698