• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, (), (override));
26   MOCK_METHOD(bool, Empty, (), (const, override));
27   MOCK_METHOD(int,
28               InsertPacket,
29               (Packet && packet, StatisticsCalculator* stats),
30               (override));
31   MOCK_METHOD(int,
32               InsertPacketList,
33               (PacketList * packet_list,
34                const DecoderDatabase& decoder_database,
35                absl::optional<uint8_t>* current_rtp_payload_type,
36                absl::optional<uint8_t>* current_cng_rtp_payload_type,
37                StatisticsCalculator* stats),
38               (override));
39   MOCK_METHOD(int,
40               NextTimestamp,
41               (uint32_t * next_timestamp),
42               (const, override));
43   MOCK_METHOD(int,
44               NextHigherTimestamp,
45               (uint32_t timestamp, uint32_t* next_timestamp),
46               (const, override));
47   MOCK_METHOD(const Packet*, PeekNextPacket, (), (const, override));
48   MOCK_METHOD(absl::optional<Packet>, GetNextPacket, (), (override));
49   MOCK_METHOD(int,
50               DiscardNextPacket,
51               (StatisticsCalculator * stats),
52               (override));
53   MOCK_METHOD(void,
54               DiscardOldPackets,
55               (uint32_t timestamp_limit,
56                uint32_t horizon_samples,
57                StatisticsCalculator* stats),
58               (override));
59   MOCK_METHOD(void,
60               DiscardAllOldPackets,
61               (uint32_t timestamp_limit, StatisticsCalculator* stats),
62               (override));
63   MOCK_METHOD(size_t, NumPacketsInBuffer, (), (const, override));
64 };
65 
66 }  // namespace webrtc
67 #endif  // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_PACKET_BUFFER_H_
68