1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ 12 #define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ 13 14 #include "modules/audio_coding/neteq/packet_buffer.h" 15 #include "test/gmock.h" 16 17 namespace webrtc { 18 19 class MockPacketBuffer : public PacketBuffer { 20 public: MockPacketBuffer(size_t max_number_of_packets,const TickTimer * tick_timer)21 MockPacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer) 22 : PacketBuffer(max_number_of_packets, tick_timer) {} ~MockPacketBuffer()23 ~MockPacketBuffer() override { Die(); } 24 MOCK_METHOD(void, Die, ()); 25 MOCK_METHOD(void, Flush, (StatisticsCalculator * stats), (override)); 26 MOCK_METHOD(void, 27 PartialFlush, 28 (int target_level_ms, 29 size_t sample_rate, 30 size_t last_decoded_length, 31 StatisticsCalculator* stats), 32 (override)); 33 MOCK_METHOD(bool, Empty, (), (const, override)); 34 MOCK_METHOD(int, 35 InsertPacket, 36 (Packet && packet, 37 StatisticsCalculator* stats, 38 size_t last_decoded_length, 39 size_t sample_rate, 40 int target_level_ms, 41 const DecoderDatabase& decoder_database), 42 (override)); 43 MOCK_METHOD(int, 44 InsertPacketList, 45 (PacketList * packet_list, 46 const DecoderDatabase& decoder_database, 47 absl::optional<uint8_t>* current_rtp_payload_type, 48 absl::optional<uint8_t>* current_cng_rtp_payload_type, 49 StatisticsCalculator* stats, 50 size_t last_decoded_length, 51 size_t sample_rate, 52 int target_level_ms), 53 (override)); 54 MOCK_METHOD(int, 55 NextTimestamp, 56 (uint32_t * next_timestamp), 57 (const, override)); 58 MOCK_METHOD(int, 59 NextHigherTimestamp, 60 (uint32_t timestamp, uint32_t* next_timestamp), 61 (const, override)); 62 MOCK_METHOD(const Packet*, PeekNextPacket, (), (const, override)); 63 MOCK_METHOD(absl::optional<Packet>, GetNextPacket, (), (override)); 64 MOCK_METHOD(int, 65 DiscardNextPacket, 66 (StatisticsCalculator * stats), 67 (override)); 68 MOCK_METHOD(void, 69 DiscardOldPackets, 70 (uint32_t timestamp_limit, 71 uint32_t horizon_samples, 72 StatisticsCalculator* stats), 73 (override)); 74 MOCK_METHOD(void, 75 DiscardAllOldPackets, 76 (uint32_t timestamp_limit, StatisticsCalculator* stats), 77 (override)); 78 MOCK_METHOD(size_t, NumPacketsInBuffer, (), (const, override)); 79 }; 80 81 } // namespace webrtc 82 #endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_ 83