Files
platform-external-webrtc/webrtc/test/fuzzers/congestion_controller_feedback_fuzzer.cc
Niels Möller 245f17e344 Delete old CongestionController class
Replaced by ReceiveSideCongestionController and
SendSideCongestionController.

Bug: webrtc:6847
Change-Id: I79caa019c883f8f716d0dd52d56bbdc2f8df0ded
Reviewed-on: https://chromium-review.googlesource.com/616763
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19423}
2017-08-21 10:43:33 +00:00

49 lines
1.9 KiB
C++

/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/congestion_controller/include/receive_side_congestion_controller.h"
#include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
namespace webrtc {
void FuzzOneInput(const uint8_t* data, size_t size) {
size_t i = 0;
if (size < sizeof(int64_t) + sizeof(uint8_t) + sizeof(uint32_t))
return;
SimulatedClock clock(data[i++]);
PacketRouter packet_router;
ReceiveSideCongestionController cc(&clock, &packet_router);
RemoteBitrateEstimator* rbe = cc.GetRemoteBitrateEstimator(true);
RTPHeader header;
header.ssrc = ByteReader<uint32_t>::ReadBigEndian(&data[i]);
i += sizeof(uint32_t);
header.extension.hasTransportSequenceNumber = true;
int64_t arrival_time_ms =
std::max<int64_t>(ByteReader<int64_t>::ReadBigEndian(&data[i]), 0);
i += sizeof(int64_t);
const size_t kMinPacketSize =
sizeof(size_t) + sizeof(uint16_t) + sizeof(uint8_t);
while (i + kMinPacketSize < size) {
size_t payload_size = ByteReader<size_t>::ReadBigEndian(&data[i]) % 1500;
i += sizeof(size_t);
header.extension.transportSequenceNumber =
ByteReader<uint16_t>::ReadBigEndian(&data[i]);
i += sizeof(uint16_t);
rbe->IncomingPacket(arrival_time_ms, payload_size, header);
clock.AdvanceTimeMilliseconds(5);
arrival_time_ms += ByteReader<uint8_t>::ReadBigEndian(&data[i]);
arrival_time_ms += sizeof(uint8_t);
}
rbe->Process();
}
} // namespace webrtc