Rename neteq4 folder to neteq

Keep the old neteq4/audio_decoder_unittests.isolate while waiting for
a hard-coded reference to change.

This CL effectively reverts r6257 "Rename neteq4 folder to neteq".

BUG=2996
TBR=tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/21629004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6367 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org
2014-06-09 08:10:28 +00:00
parent 31f967c611
commit 9c55f0f957
158 changed files with 547 additions and 511 deletions

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_AUDIO_DECODER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockAudioDecoder : public AudioDecoder {
public:
MockAudioDecoder() : AudioDecoder(kDecoderArbitrary) {}
virtual ~MockAudioDecoder() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD4(Decode, int(const uint8_t*, size_t, int16_t*,
AudioDecoder::SpeechType*));
MOCK_CONST_METHOD0(HasDecodePlc, bool());
MOCK_METHOD2(DecodePlc, int(int, int16_t*));
MOCK_METHOD0(Init, int());
MOCK_METHOD5(IncomingPacket, int(const uint8_t*, size_t, uint16_t, uint32_t,
uint32_t));
MOCK_METHOD0(ErrorCode, int());
MOCK_CONST_METHOD0(codec_type, NetEqDecoder());
MOCK_METHOD1(CodecSupported, bool(NetEqDecoder));
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_AUDIO_VECTOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_VECTOR_H_
#include "webrtc/modules/audio_coding/neteq/audio_vector.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockAudioVector : public AudioVector {
public:
MOCK_METHOD0(Clear,
void());
MOCK_CONST_METHOD1(CopyFrom,
void(AudioVector<T>* copy_to));
MOCK_METHOD1(PushFront,
void(const AudioVector<T>& prepend_this));
MOCK_METHOD2(PushFront,
void(const T* prepend_this, size_t length));
MOCK_METHOD1(PushBack,
void(const AudioVector<T>& append_this));
MOCK_METHOD2(PushBack,
void(const T* append_this, size_t length));
MOCK_METHOD1(PopFront,
void(size_t length));
MOCK_METHOD1(PopBack,
void(size_t length));
MOCK_METHOD1(Extend,
void(size_t extra_length));
MOCK_METHOD3(InsertAt,
void(const T* insert_this, size_t length, size_t position));
MOCK_METHOD3(OverwriteAt,
void(const T* insert_this, size_t length, size_t position));
MOCK_CONST_METHOD0(Size,
size_t());
MOCK_CONST_METHOD0(Empty,
bool());
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_VECTOR_H_

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockBufferLevelFilter : public BufferLevelFilter {
public:
virtual ~MockBufferLevelFilter() { Die(); }
MOCK_METHOD0(Die,
void());
MOCK_METHOD0(Reset,
void());
MOCK_METHOD3(Update,
void(int buffer_size_packets, int time_stretched_samples,
int packet_len_samples));
MOCK_METHOD1(SetTargetBufferLevel,
void(int target_buffer_level));
MOCK_CONST_METHOD0(filtered_current_level,
int());
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_BUFFER_LEVEL_FILTER_H_

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_DECODER_DATABASE_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DECODER_DATABASE_H_
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockDecoderDatabase : public DecoderDatabase {
public:
virtual ~MockDecoderDatabase() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_CONST_METHOD0(Empty,
bool());
MOCK_CONST_METHOD0(Size,
int());
MOCK_METHOD0(Reset,
void());
MOCK_METHOD2(RegisterPayload,
int(uint8_t rtp_payload_type, NetEqDecoder codec_type));
MOCK_METHOD4(InsertExternal,
int(uint8_t rtp_payload_type, NetEqDecoder codec_type, int fs_hz,
AudioDecoder* decoder));
MOCK_METHOD1(Remove,
int(uint8_t rtp_payload_type));
MOCK_CONST_METHOD1(GetDecoderInfo,
const DecoderInfo*(uint8_t rtp_payload_type));
MOCK_CONST_METHOD1(GetRtpPayloadType,
uint8_t(NetEqDecoder codec_type));
MOCK_METHOD1(GetDecoder,
AudioDecoder*(uint8_t rtp_payload_type));
MOCK_CONST_METHOD2(IsType,
bool(uint8_t rtp_payload_type, NetEqDecoder codec_type));
MOCK_CONST_METHOD1(IsComfortNoise,
bool(uint8_t rtp_payload_type));
MOCK_CONST_METHOD1(IsDtmf,
bool(uint8_t rtp_payload_type));
MOCK_CONST_METHOD1(IsRed,
bool(uint8_t rtp_payload_type));
MOCK_METHOD2(SetActiveDecoder,
int(uint8_t rtp_payload_type, bool* new_decoder));
MOCK_METHOD0(GetActiveDecoder,
AudioDecoder*());
MOCK_METHOD1(SetActiveCngDecoder,
int(uint8_t rtp_payload_type));
MOCK_METHOD0(GetActiveCngDecoder,
AudioDecoder*());
MOCK_CONST_METHOD1(CheckPayloadTypes,
int(const PacketList& packet_list));
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DECODER_DATABASE_H_

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_DELAY_MANAGER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DELAY_MANAGER_H_
#include "webrtc/modules/audio_coding/neteq/delay_manager.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockDelayManager : public DelayManager {
public:
MockDelayManager(int max_packets_in_buffer, DelayPeakDetector* peak_detector)
: DelayManager(max_packets_in_buffer, peak_detector) {}
virtual ~MockDelayManager() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_CONST_METHOD0(iat_vector,
const IATVector&());
MOCK_METHOD3(Update,
int(uint16_t sequence_number, uint32_t timestamp, int sample_rate_hz));
MOCK_METHOD1(CalculateTargetLevel,
int(int iat_packets));
MOCK_METHOD1(SetPacketAudioLength,
int(int length_ms));
MOCK_METHOD0(Reset,
void());
MOCK_CONST_METHOD0(AverageIAT,
int());
MOCK_CONST_METHOD0(PeakFound,
bool());
MOCK_METHOD1(UpdateCounters,
void(int elapsed_time_ms));
MOCK_METHOD0(ResetPacketIatCount,
void());
MOCK_CONST_METHOD2(BufferLimits,
void(int* lower_limit, int* higher_limit));
MOCK_CONST_METHOD0(TargetLevel,
int());
MOCK_METHOD1(LastDecoderType,
void(NetEqDecoder decoder_type));
MOCK_METHOD1(set_extra_delay_ms,
void(int16_t delay));
MOCK_CONST_METHOD0(base_target_level,
int());
MOCK_METHOD1(set_streaming_mode,
void(bool value));
MOCK_CONST_METHOD0(last_pack_cng_or_dtmf,
int());
MOCK_METHOD1(set_last_pack_cng_or_dtmf,
void(int value));
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DELAY_MANAGER_H_

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_DELAY_PEAK_DETECTOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DELAY_PEAK_DETECTOR_H_
#include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockDelayPeakDetector : public DelayPeakDetector {
public:
virtual ~MockDelayPeakDetector() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD0(Reset, void());
MOCK_METHOD1(SetPacketAudioLength, void(int length_ms));
MOCK_METHOD0(peak_found, bool());
MOCK_CONST_METHOD0(MaxPeakHeight, int());
MOCK_CONST_METHOD0(MaxPeakPeriod, int());
MOCK_METHOD2(Update, bool(int inter_arrival_time, int target_level));
MOCK_METHOD1(IncrementCounter, void(int inc_ms));
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DELAY_PEAK_DETECTOR_H_

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_DTMF_BUFFER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_BUFFER_H_
#include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockDtmfBuffer : public DtmfBuffer {
public:
MockDtmfBuffer(int fs) : DtmfBuffer(fs) {}
virtual ~MockDtmfBuffer() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD0(Flush,
void());
MOCK_METHOD1(InsertEvent,
int(const DtmfEvent& event));
MOCK_METHOD2(GetEvent,
bool(uint32_t current_timestamp, DtmfEvent* event));
MOCK_CONST_METHOD0(Length,
size_t());
MOCK_CONST_METHOD0(Empty,
bool());
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_BUFFER_H_

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_DTMF_TONE_GENERATOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_TONE_GENERATOR_H_
#include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockDtmfToneGenerator : public DtmfToneGenerator {
public:
virtual ~MockDtmfToneGenerator() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD3(Init,
int(int fs, int event, int attenuation));
MOCK_METHOD0(Reset,
void());
MOCK_METHOD2(Generate,
int(int num_samples, AudioMultiVector* output));
MOCK_CONST_METHOD0(initialized,
bool());
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DTMF_TONE_GENERATOR_H_

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2013 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_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
#include "gmock/gmock.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
#include "webrtc/typedefs.h"
namespace webrtc {
using ::testing::_;
using ::testing::Invoke;
// Implement an external version of the PCM16b decoder. This is a copy from
// audio_decoder_impl.{cc, h}.
class ExternalPcm16B : public AudioDecoder {
public:
explicit ExternalPcm16B(enum NetEqDecoder type)
: AudioDecoder(type) {
}
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
int16_t* decoded, SpeechType* speech_type) {
int16_t temp_type;
int16_t ret = WebRtcPcm16b_DecodeW16(
state_, reinterpret_cast<int16_t*>(const_cast<uint8_t*>(encoded)),
static_cast<int16_t>(encoded_len), decoded, &temp_type);
*speech_type = ConvertSpeechType(temp_type);
return ret;
}
virtual int Init() { return 0; }
private:
DISALLOW_COPY_AND_ASSIGN(ExternalPcm16B);
};
// Create a mock of ExternalPcm16B which delegates all calls to the real object.
// The reason is that we can then track that the correct calls are being made.
class MockExternalPcm16B : public ExternalPcm16B {
public:
explicit MockExternalPcm16B(enum NetEqDecoder type)
: ExternalPcm16B(type),
real_(type) {
// By default, all calls are delegated to the real object.
ON_CALL(*this, Decode(_, _, _, _))
.WillByDefault(Invoke(&real_, &ExternalPcm16B::Decode));
ON_CALL(*this, HasDecodePlc())
.WillByDefault(Invoke(&real_, &ExternalPcm16B::HasDecodePlc));
ON_CALL(*this, DecodePlc(_, _))
.WillByDefault(Invoke(&real_, &ExternalPcm16B::DecodePlc));
ON_CALL(*this, Init())
.WillByDefault(Invoke(&real_, &ExternalPcm16B::Init));
ON_CALL(*this, IncomingPacket(_, _, _, _, _))
.WillByDefault(Invoke(&real_, &ExternalPcm16B::IncomingPacket));
ON_CALL(*this, ErrorCode())
.WillByDefault(Invoke(&real_, &ExternalPcm16B::ErrorCode));
ON_CALL(*this, codec_type())
.WillByDefault(Invoke(&real_, &ExternalPcm16B::codec_type));
}
virtual ~MockExternalPcm16B() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD4(Decode,
int(const uint8_t* encoded, size_t encoded_len, int16_t* decoded,
SpeechType* speech_type));
MOCK_CONST_METHOD0(HasDecodePlc,
bool());
MOCK_METHOD2(DecodePlc,
int(int num_frames, int16_t* decoded));
MOCK_METHOD0(Init,
int());
MOCK_METHOD5(IncomingPacket,
int(const uint8_t* payload, size_t payload_len,
uint16_t rtp_sequence_number, uint32_t rtp_timestamp,
uint32_t arrival_timestamp));
MOCK_METHOD0(ErrorCode,
int());
MOCK_CONST_METHOD0(codec_type,
NetEqDecoder());
private:
ExternalPcm16B real_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_

View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_PACKET_BUFFER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
#include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockPacketBuffer : public PacketBuffer {
public:
MockPacketBuffer(size_t max_number_of_packets)
: PacketBuffer(max_number_of_packets) {}
virtual ~MockPacketBuffer() { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD0(Flush,
void());
MOCK_CONST_METHOD0(Empty,
bool());
MOCK_METHOD1(InsertPacket,
int(Packet* packet));
MOCK_METHOD4(InsertPacketList,
int(PacketList* packet_list,
const DecoderDatabase& decoder_database,
uint8_t* current_rtp_payload_type,
uint8_t* current_cng_rtp_payload_type));
MOCK_CONST_METHOD1(NextTimestamp,
int(uint32_t* next_timestamp));
MOCK_CONST_METHOD2(NextHigherTimestamp,
int(uint32_t timestamp, uint32_t* next_timestamp));
MOCK_CONST_METHOD0(NextRtpHeader,
const RTPHeader*());
MOCK_METHOD1(GetNextPacket,
Packet*(int* discard_count));
MOCK_METHOD0(DiscardNextPacket,
int());
MOCK_METHOD1(DiscardOldPackets,
int(uint32_t timestamp_limit));
MOCK_CONST_METHOD0(NumPacketsInBuffer,
int());
MOCK_METHOD1(IncrementWaitingTimes,
void(int));
MOCK_CONST_METHOD0(current_memory_bytes,
int());
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2012 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_MOCK_MOCK_PAYLOAD_SPLITTER_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PAYLOAD_SPLITTER_H_
#include "webrtc/modules/audio_coding/neteq/payload_splitter.h"
#include "gmock/gmock.h"
namespace webrtc {
class MockPayloadSplitter : public PayloadSplitter {
public:
MOCK_METHOD1(SplitRed,
int(PacketList* packet_list));
MOCK_METHOD2(SplitFec,
int(PacketList* packet_list, DecoderDatabase* decoder_database));
MOCK_METHOD2(CheckRedPayloads,
int(PacketList* packet_list, const DecoderDatabase& decoder_database));
MOCK_METHOD2(SplitAudio,
int(PacketList* packet_list, const DecoderDatabase& decoder_database));
MOCK_METHOD4(SplitBySamples,
void(const Packet* packet, int bytes_per_ms, int timestamps_per_ms,
PacketList* new_packets));
MOCK_METHOD4(SplitByFrames,
int(const Packet* packet, int bytes_per_frame, int timestamps_per_frame,
PacketList* new_packets));
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PAYLOAD_SPLITTER_H_