Revert of Setting up an RTP input fuzzer for NetEq (patchset #2 id:20001 of https://codereview.webrtc.org/2315633002/ )

Reason for revert:
Broke all Chromium libFuzzer builds
https://bugs.chromium.org/p/chromium/issues/detail?id=645069

Original issue's description:
> Setting up an RTP input fuzzer for NetEq
>
> This CL introduces a new fuzzer target neteq_rtp_fuzzer that
> manipulates the RTP header fields before inserting the packets into
> NetEq. A few helper classes are also introduced.
>
> BUG=webrtc:5447
> NOTRY=True
>
> Committed: https://crrev.com/2d273f1e97cd5030ed1686f27ce1118291b66395
> Cr-Commit-Position: refs/heads/master@{#14103}

TBR=ivoc@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5447

Review-Url: https://codereview.webrtc.org/2328483002
Cr-Commit-Position: refs/heads/master@{#14131}
This commit is contained in:
henrik.lundin
2016-09-08 05:00:36 -07:00
committed by Commit bot
parent 17e3fa1fb4
commit 22c8d5a3e0
7 changed files with 1 additions and 313 deletions

View File

@ -231,8 +231,6 @@
'tools/audio_sink.cc',
'tools/constant_pcm_packet_source.cc',
'tools/constant_pcm_packet_source.h',
'tools/encode_neteq_input.cc',
'tools/encode_neteq_input.h',
'tools/fake_decode_from_file.cc',
'tools/fake_decode_from_file.h',
'tools/input_audio_file.cc',

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2016 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/audio_coding/neteq/tools/encode_neteq_input.h"
#include <utility>
#include "webrtc/base/checks.h"
namespace webrtc {
namespace test {
EncodeNetEqInput::EncodeNetEqInput(std::unique_ptr<InputAudioFile> input,
std::unique_ptr<AudioEncoder> encoder,
int64_t input_duration_ms)
: input_(std::move(input)),
encoder_(std::move(encoder)),
input_duration_ms_(input_duration_ms) {
CreatePacket();
}
rtc::Optional<int64_t> EncodeNetEqInput::NextPacketTime() const {
RTC_DCHECK(packet_data_);
return rtc::Optional<int64_t>(static_cast<int64_t>(packet_data_->time_ms));
}
rtc::Optional<int64_t> EncodeNetEqInput::NextOutputEventTime() const {
return rtc::Optional<int64_t>(next_output_event_ms_);
}
std::unique_ptr<NetEqInput::PacketData> EncodeNetEqInput::PopPacket() {
RTC_DCHECK(packet_data_);
// Grab the packet to return...
std::unique_ptr<PacketData> packet_to_return = std::move(packet_data_);
// ... and line up the next packet for future use.
CreatePacket();
return packet_to_return;
}
void EncodeNetEqInput::AdvanceOutputEvent() {
next_output_event_ms_ += kOutputPeriodMs;
}
rtc::Optional<RTPHeader> EncodeNetEqInput::NextHeader() const {
RTC_DCHECK(packet_data_);
return rtc::Optional<RTPHeader>(packet_data_->header.header);
}
void EncodeNetEqInput::CreatePacket() {
// Create a new PacketData object.
RTC_DCHECK(!packet_data_);
packet_data_.reset(new NetEqInput::PacketData);
RTC_DCHECK_EQ(packet_data_->payload.size(), 0u);
// Loop until we get a packet.
AudioEncoder::EncodedInfo info;
RTC_DCHECK(!info.send_even_if_empty);
int num_blocks = 0;
while (packet_data_->payload.size() == 0 && !info.send_even_if_empty) {
const size_t num_samples = rtc::CheckedDivExact(
static_cast<int>(encoder_->SampleRateHz() * kOutputPeriodMs), 1000);
std::unique_ptr<int16_t[]> audio(new int16_t[num_samples]);
RTC_CHECK(input_->Read(num_samples, audio.get()));
info = encoder_->Encode(
rtp_timestamp_, rtc::ArrayView<const int16_t>(audio.get(), num_samples),
&packet_data_->payload);
rtp_timestamp_ +=
num_samples * encoder_->RtpTimestampRateHz() / encoder_->SampleRateHz();
++num_blocks;
}
packet_data_->header.header.timestamp = info.encoded_timestamp;
packet_data_->header.header.payloadType = info.payload_type;
packet_data_->header.header.sequenceNumber = sequence_number_++;
packet_data_->time_ms = next_packet_time_ms_;
next_packet_time_ms_ += num_blocks * kOutputPeriodMs;
}
} // namespace test
} // namespace webrtc

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) 2016 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_ENCODE_NETEQ_INPUT_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_ENCODE_NETEQ_INPUT_H_
#include <memory>
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_input.h"
#include "webrtc/modules/include/module_common_types.h"
namespace webrtc {
namespace test {
// This class provides a NetEqInput that takes audio from an input file and
// encodes it using a given audio encoder.
class EncodeNetEqInput : public NetEqInput {
public:
// The source will end after the given input duration.
EncodeNetEqInput(std::unique_ptr<InputAudioFile> input,
std::unique_ptr<AudioEncoder> encoder,
int64_t input_duration_ms);
rtc::Optional<int64_t> NextPacketTime() const override;
rtc::Optional<int64_t> NextOutputEventTime() const override;
std::unique_ptr<PacketData> PopPacket() override;
void AdvanceOutputEvent() override;
bool ended() const override {
return next_output_event_ms_ <= input_duration_ms_;
}
rtc::Optional<RTPHeader> NextHeader() const override;
private:
static constexpr int64_t kOutputPeriodMs = 10;
void CreatePacket();
std::unique_ptr<InputAudioFile> input_;
std::unique_ptr<AudioEncoder> encoder_;
std::unique_ptr<PacketData> packet_data_;
int32_t rtp_timestamp_ = 0;
int16_t sequence_number_ = 0;
int64_t next_packet_time_ms_ = 0;
int64_t next_output_event_ms_ = 0;
const int64_t input_duration_ms_;
};
} // namespace test
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_ENCODE_NETEQ_INPUT_H_

View File

@ -65,9 +65,7 @@ class NetEqInput {
// time).
virtual void AdvanceOutputEvent() = 0;
// Returns true if the source has come to an end. An implementation must
// eventually return true from this method, or the test will end up in an
// infinite loop.
// Returns true if the source has come to an end.
virtual bool ended() const = 0;
// Returns the RTP header for the next packet, i.e., the packet that will be