mock_decoder_database.h (2171B)
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_DECODER_DATABASE_H_ 12 #define MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DECODER_DATABASE_H_ 13 14 #include <cstdint> 15 #include <optional> 16 17 #include "api/audio_codecs/audio_decoder.h" 18 #include "api/audio_codecs/audio_format.h" 19 #include "api/environment/environment_factory.h" 20 #include "modules/audio_coding/codecs/cng/webrtc_cng.h" 21 #include "modules/audio_coding/neteq/decoder_database.h" 22 #include "test/gmock.h" 23 24 namespace webrtc { 25 26 class MockDecoderDatabase : public DecoderDatabase { 27 public: 28 MockDecoderDatabase() 29 : DecoderDatabase(CreateEnvironment(), 30 /*decoder_factory=*/nullptr, 31 /*codec_pair_id=*/std::nullopt) {} 32 ~MockDecoderDatabase() override { Die(); } 33 MOCK_METHOD(void, Die, ()); 34 MOCK_METHOD(bool, Empty, (), (const, override)); 35 MOCK_METHOD(int, Size, (), (const, override)); 36 MOCK_METHOD(int, 37 RegisterPayload, 38 (int rtp_payload_type, const SdpAudioFormat& audio_format), 39 (override)); 40 MOCK_METHOD(int, Remove, (uint8_t rtp_payload_type), (override)); 41 MOCK_METHOD(void, RemoveAll, (), (override)); 42 MOCK_METHOD(const DecoderInfo*, 43 GetDecoderInfo, 44 (uint8_t rtp_payload_type), 45 (const, override)); 46 MOCK_METHOD(int, 47 SetActiveDecoder, 48 (uint8_t rtp_payload_type, bool* new_decoder), 49 (override)); 50 MOCK_METHOD(AudioDecoder*, GetActiveDecoder, (), (const, override)); 51 MOCK_METHOD(int, SetActiveCngDecoder, (uint8_t rtp_payload_type), (override)); 52 MOCK_METHOD(ComfortNoiseDecoder*, GetActiveCngDecoder, (), (const, override)); 53 }; 54 55 } // namespace webrtc 56 #endif // MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_DECODER_DATABASE_H_