Delete AudioDecoder method IncomingPacket

Only the ISAC codec had an non-trivial implementation, for its unused
adaptive mode. This cl deletes that implementation, and the call
from NetEq, and the interface method.

Bug: webrtc:10098
Change-Id: Iaf7667e0ae867fc9d64286dff4c01a8ce0b6e2a4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153882
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29279}
This commit is contained in:
Niels Möller 2019-09-20 15:55:26 +02:00 committed by Commit Bot
parent 82ce384801
commit ef14f072a9
15 changed files with 0 additions and 161 deletions

View File

@ -135,14 +135,6 @@ size_t AudioDecoder::DecodePlc(size_t num_frames, int16_t* decoded) {
void AudioDecoder::GeneratePlc(size_t /*requested_samples_per_channel*/,
rtc::BufferT<int16_t>* /*concealment_audio*/) {}
int AudioDecoder::IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
return 0;
}
int AudioDecoder::ErrorCode() {
return 0;
}

View File

@ -143,13 +143,6 @@ class AudioDecoder {
// Resets the decoder state (empty buffers etc.).
virtual void Reset() = 0;
// Notifies the decoder of an incoming packet to NetEQ.
virtual int IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp);
// Returns the last error code from the decoder.
virtual int ErrorCode();

View File

@ -973,10 +973,6 @@ TEST_F(AcmReceiverBitExactnessOldApi, 48kHzOutputExternalDecoder) {
fact_(CreateBuiltinAudioDecoderFactory()) {
// Set expectations on the mock decoder and also delegate the calls to
// the real decoder.
EXPECT_CALL(*mock_decoder_, IncomingPacket(_, _, _, _, _))
.Times(AtLeast(1))
.WillRepeatedly(
Invoke(&pcmu_decoder_, &AudioDecoderPcmU::IncomingPacket));
EXPECT_CALL(*mock_decoder_, SampleRateHz())
.Times(AtLeast(1))
.WillRepeatedly(

View File

@ -33,11 +33,6 @@ class AudioDecoderIsacT final : public AudioDecoder {
bool HasDecodePlc() const override;
size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
void Reset() override;
int IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) override;
int ErrorCode() override;
int SampleRateHz() const override;
size_t Channels() const override;

View File

@ -64,18 +64,6 @@ void AudioDecoderIsacT<T>::Reset() {
T::DecoderInit(isac_state_);
}
template <typename T>
int AudioDecoderIsacT<T>::IncomingPacket(const uint8_t* payload,
size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
int ret = T::UpdateBwEstimate(isac_state_, payload, payload_len,
rtp_sequence_number, rtp_timestamp,
arrival_timestamp);
return ret;
}
template <typename T>
int AudioDecoderIsacT<T>::ErrorCode() {
return T::GetErrorCode(isac_state_);

View File

@ -90,15 +90,6 @@ class IsacFix {
int bottleneck_bits_per_second) {
WebRtcIsacfix_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsacfix_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsacfix_SetMaxPayloadSize(inst, max_payload_size_bytes);

View File

@ -87,15 +87,6 @@ struct IsacFloat {
int bottleneck_bits_per_second) {
WebRtcIsac_SetInitialBweBottleneck(inst, bottleneck_bits_per_second);
}
static inline int16_t UpdateBwEstimate(instance_type* inst,
const uint8_t* encoded,
size_t packet_size,
uint16_t rtp_seq_number,
uint32_t send_ts,
uint32_t arr_ts) {
return WebRtcIsac_UpdateBwEstimate(inst, encoded, packet_size,
rtp_seq_number, send_ts, arr_ts);
}
static inline int16_t SetMaxPayloadSize(instance_type* inst,
int16_t max_payload_size_bytes) {
return WebRtcIsac_SetMaxPayloadSize(inst, max_payload_size_bytes);

View File

@ -594,19 +594,6 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
}
}
// Update bandwidth estimate, if the packet is not comfort noise.
if (!packet_list.empty() &&
!decoder_database_->IsComfortNoise(main_payload_type)) {
// The list can be empty here if we got nothing but DTMF payloads.
AudioDecoder* decoder = decoder_database_->GetDecoder(main_payload_type);
RTC_DCHECK(decoder); // Should always get a valid object, since we have
// already checked that the payload types are known.
decoder->IncomingPacket(packet_list.front().payload.data(),
packet_list.front().payload.size(),
packet_list.front().sequence_number,
packet_list.front().timestamp, receive_timestamp);
}
PacketList parsed_packet_list;
while (!packet_list.empty()) {
Packet& packet = packet_list.front();

View File

@ -335,15 +335,6 @@ TEST_F(NetEqImplTest, InsertPacket) {
std::unique_ptr<MockAudioDecoder> mock_decoder(new MockAudioDecoder);
EXPECT_CALL(*mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(*mock_decoder, SampleRateHz()).WillRepeatedly(Return(8000));
// BWE update function called with first packet.
EXPECT_CALL(*mock_decoder,
IncomingPacket(_, kPayloadLength, kFirstSequenceNumber,
kFirstTimestamp, kFirstReceiveTime));
// BWE update function called with second packet.
EXPECT_CALL(
*mock_decoder,
IncomingPacket(_, kPayloadLength, kFirstSequenceNumber + 1,
kFirstTimestamp + 160, kFirstReceiveTime + 155));
EXPECT_CALL(*mock_decoder, Die()).Times(1); // Called when deleted.
*dec = std::move(mock_decoder);
@ -595,8 +586,6 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
EXPECT_CALL(mock_decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateHz));
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, kPayloadLengthBytes))
.WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
int16_t dummy_output[kPayloadLengthSamples] = {0};
@ -837,8 +826,6 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
EXPECT_CALL(mock_decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateKhz * 1000));
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, kPayloadLengthBytes))
.WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
// Packed duration when asking the decoder for more CNG data (without a new
@ -1112,8 +1099,6 @@ TEST_F(NetEqImplTest, DecodedPayloadTooShort) {
EXPECT_CALL(mock_decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateHz));
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
.WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
int16_t dummy_output[kPayloadLengthSamples] = {0};
@ -1181,8 +1166,6 @@ TEST_F(NetEqImplTest, DecodingError) {
EXPECT_CALL(mock_decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateHz));
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
.WillRepeatedly(Return(rtc::checked_cast<int>(kFrameLengthSamples)));
EXPECT_CALL(mock_decoder, ErrorCode()).WillOnce(Return(kDecoderErrorCode));
@ -1297,8 +1280,6 @@ TEST_F(NetEqImplTest, DecodingErrorDuringInternalCng) {
EXPECT_CALL(mock_decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateHz));
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
.WillRepeatedly(Return(rtc::checked_cast<int>(kFrameLengthSamples)));
EXPECT_CALL(mock_decoder, ErrorCode()).WillOnce(Return(kDecoderErrorCode));

View File

@ -240,15 +240,6 @@ std::unique_ptr<webrtc::AudioDecoder> CreateForwardingMockDecoder(
EXPECT_CALL(*mock_decoder, HasDecodePlc()).WillRepeatedly(Invoke([dec] {
return dec->HasDecodePlc();
}));
EXPECT_CALL(*mock_decoder, IncomingPacket(_, _, _, _, _))
.Times(AtLeast(1))
.WillRepeatedly(Invoke([dec](const uint8_t* payload, size_t payload_len,
uint16_t rtp_sequence_number,
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) {
return dec->IncomingPacket(payload, payload_len, rtp_sequence_number,
rtp_timestamp, arrival_timestamp);
}));
EXPECT_CALL(*mock_decoder, PacketDuration(_, _))
.Times(AtLeast(1))
.WillRepeatedly(Invoke([dec](const uint8_t* encoded, size_t encoded_len) {

View File

@ -296,16 +296,6 @@ webrtc_fuzzer_test("audio_decoder_isac_fuzzer") {
]
}
webrtc_fuzzer_test("audio_decoder_isac_incoming_packet_fuzzer") {
sources = [
"audio_decoder_isac_incoming_packet_fuzzer.cc",
]
deps = [
":audio_decoder_fuzzer",
"../../modules/audio_coding:isac",
]
}
webrtc_fuzzer_test("audio_decoder_isacfix_fuzzer") {
sources = [
"audio_decoder_isacfix_fuzzer.cc",

View File

@ -74,31 +74,4 @@ void FuzzAudioDecoder(DecoderFunctionType decode_type,
}
}
// This function is similar to FuzzAudioDecoder, but also reads fuzzed data into
// RTP header values. The fuzzed data and values are sent to the decoder's
// IncomingPacket method.
void FuzzAudioDecoderIncomingPacket(const uint8_t* data,
size_t size,
AudioDecoder* decoder) {
const uint8_t* data_ptr = data;
size_t remaining_size = size;
size_t packet_len;
while (ParseInt<size_t, 2>(&data_ptr, &remaining_size, &packet_len)) {
uint16_t rtp_sequence_number;
if (!ParseInt(&data_ptr, &remaining_size, &rtp_sequence_number))
break;
uint32_t rtp_timestamp;
if (!ParseInt(&data_ptr, &remaining_size, &rtp_timestamp))
break;
uint32_t arrival_timestamp;
if (!ParseInt(&data_ptr, &remaining_size, &arrival_timestamp))
break;
if (remaining_size < packet_len)
break;
decoder->IncomingPacket(data_ptr, packet_len, rtp_sequence_number,
rtp_timestamp, arrival_timestamp);
data_ptr += packet_len;
remaining_size -= packet_len;
}
}
} // namespace webrtc

View File

@ -31,9 +31,6 @@ void FuzzAudioDecoder(DecoderFunctionType decode_type,
size_t max_decoded_bytes,
int16_t* decoded);
void FuzzAudioDecoderIncomingPacket(const uint8_t* data,
size_t size,
AudioDecoder* decoder);
} // namespace webrtc
#endif // TEST_FUZZERS_AUDIO_DECODER_FUZZER_H_

View File

@ -1,24 +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 "modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
#include "test/fuzzers/audio_decoder_fuzzer.h"
namespace webrtc {
void FuzzOneInput(const uint8_t* data, size_t size) {
if (size > 20000) {
return;
}
AudioDecoderIsacFloatImpl::Config c;
c.sample_rate_hz = 16000;
AudioDecoderIsacFloatImpl dec(c);
FuzzAudioDecoderIncomingPacket(data, size, &dec);
}
} // namespace webrtc

View File

@ -26,8 +26,6 @@ class MockAudioDecoder : public AudioDecoder {
MOCK_CONST_METHOD0(HasDecodePlc, bool());
MOCK_METHOD2(DecodePlc, size_t(size_t, int16_t*));
MOCK_METHOD0(Reset, void());
MOCK_METHOD5(IncomingPacket,
int(const uint8_t*, size_t, uint16_t, uint32_t, uint32_t));
MOCK_METHOD0(ErrorCode, int());
MOCK_CONST_METHOD2(PacketDuration, int(const uint8_t*, size_t));
MOCK_CONST_METHOD0(Channels, size_t());