change PacketBuffer to return it's result rather that use callback

Bug: None
Change-Id: I8cc05dd46e811d6db37af520d2106af21c671def
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157893
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29589}
This commit is contained in:
Danil Chapovalov
2019-10-22 17:12:42 +02:00
committed by Commit Bot
parent 2522b25f19
commit ce1ffcdc06
8 changed files with 173 additions and 191 deletions

View File

@ -14,20 +14,16 @@
#include "test/fuzzers/fuzz_data_helper.h"
namespace webrtc {
namespace {
class NullCallback : public video_coding::OnAssembledFrameCallback {
void OnAssembledFrame(std::unique_ptr<video_coding::RtpFrameObject> frame) {}
};
} // namespace
void IgnoreResult(video_coding::PacketBuffer::InsertResult result) {}
void FuzzOneInput(const uint8_t* data, size_t size) {
if (size > 200000) {
return;
}
VCMPacket packet;
NullCallback callback;
SimulatedClock clock(0);
video_coding::PacketBuffer packet_buffer(&clock, 8, 1024, &callback);
video_coding::PacketBuffer packet_buffer(&clock, 8, 1024);
test::FuzzDataHelper helper(rtc::ArrayView<const uint8_t>(data, size));
while (helper.BytesLeft()) {
@ -59,7 +55,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
packet.sizeBytes = payload_size;
packet.dataPtr = new uint8_t[payload_size];
packet_buffer.InsertPacket(&packet);
IgnoreResult(packet_buffer.InsertPacket(&packet));
}
}