2013-01-29 12:09:21 +00:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
|
|
|
|
|
#define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
|
2013-01-29 12:09:21 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_coding/neteq/packet_buffer.h"
|
|
|
|
|
#include "test/gmock.h"
|
2013-01-29 12:09:21 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class MockPacketBuffer : public PacketBuffer {
|
|
|
|
|
public:
|
2016-04-26 07:45:16 -07:00
|
|
|
MockPacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer)
|
|
|
|
|
: PacketBuffer(max_number_of_packets, tick_timer) {}
|
2013-01-29 12:09:21 +00:00
|
|
|
virtual ~MockPacketBuffer() { Die(); }
|
|
|
|
|
MOCK_METHOD0(Die, void());
|
|
|
|
|
MOCK_METHOD0(Flush, void());
|
|
|
|
|
MOCK_CONST_METHOD0(Empty, bool());
|
2017-07-19 11:44:06 +02:00
|
|
|
int InsertPacket(Packet&& packet, StatisticsCalculator* stats) {
|
|
|
|
|
return InsertPacketWrapped(&packet, stats);
|
2016-10-24 08:25:28 -07:00
|
|
|
}
|
|
|
|
|
// Since gtest does not properly support move-only types, InsertPacket is
|
|
|
|
|
// implemented as a wrapper. You'll have to implement InsertPacketWrapped
|
|
|
|
|
// instead and move from |*packet|.
|
2017-07-19 11:44:06 +02:00
|
|
|
MOCK_METHOD2(InsertPacketWrapped,
|
|
|
|
|
int(Packet* packet, StatisticsCalculator* stats));
|
|
|
|
|
MOCK_METHOD5(InsertPacketList,
|
|
|
|
|
int(PacketList* packet_list,
|
|
|
|
|
const DecoderDatabase& decoder_database,
|
2018-06-19 13:26:36 +02:00
|
|
|
absl::optional<uint8_t>* current_rtp_payload_type,
|
|
|
|
|
absl::optional<uint8_t>* current_cng_rtp_payload_type,
|
2017-07-19 11:44:06 +02:00
|
|
|
StatisticsCalculator* stats));
|
2013-01-29 12:09:21 +00:00
|
|
|
MOCK_CONST_METHOD1(NextTimestamp, int(uint32_t* next_timestamp));
|
|
|
|
|
MOCK_CONST_METHOD2(NextHigherTimestamp,
|
|
|
|
|
int(uint32_t timestamp, uint32_t* next_timestamp));
|
2016-10-18 04:06:13 -07:00
|
|
|
MOCK_CONST_METHOD0(PeekNextPacket, const Packet*());
|
2018-06-19 13:26:36 +02:00
|
|
|
MOCK_METHOD0(GetNextPacket, absl::optional<Packet>());
|
2017-07-05 11:17:40 +02:00
|
|
|
MOCK_METHOD1(DiscardNextPacket, int(StatisticsCalculator* stats));
|
|
|
|
|
MOCK_METHOD3(DiscardOldPackets,
|
|
|
|
|
void(uint32_t timestamp_limit,
|
|
|
|
|
uint32_t horizon_samples,
|
|
|
|
|
StatisticsCalculator* stats));
|
|
|
|
|
MOCK_METHOD2(DiscardAllOldPackets,
|
|
|
|
|
void(uint32_t timestamp_limit, StatisticsCalculator* stats));
|
2013-01-29 12:09:21 +00:00
|
|
|
MOCK_CONST_METHOD0(NumPacketsInBuffer, size_t());
|
|
|
|
|
MOCK_METHOD1(IncrementWaitingTimes, void(int));
|
|
|
|
|
MOCK_CONST_METHOD0(current_memory_bytes, int());
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
|