solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 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 | |
Fredrik Solenberg | a8b7c7f | 2018-01-17 11:18:31 +0100 | [diff] [blame] | 11 | #ifndef AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ |
| 12 | #define AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 13 | |
Fredrik Solenberg | a8b7c7f | 2018-01-17 11:18:31 +0100 | [diff] [blame] | 14 | #include <map> |
| 15 | #include <memory> |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 16 | #include <string> |
Fredrik Solenberg | f693bfa | 2018-12-11 12:22:10 +0100 | [diff] [blame] | 17 | #include <utility> |
Fredrik Solenberg | a8b7c7f | 2018-01-17 11:18:31 +0100 | [diff] [blame] | 18 | #include <vector> |
kwiberg | ac9f876 | 2016-09-30 22:29:43 -0700 | [diff] [blame] | 19 | |
Benjamin Wright | 78410ad | 2018-10-25 09:52:57 -0700 | [diff] [blame] | 20 | #include "api/test/mock_frame_encryptor.h" |
Niels Möller | 349ade3 | 2018-11-16 09:50:42 +0100 | [diff] [blame] | 21 | #include "audio/channel_receive.h" |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 22 | #include "audio/channel_send.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 23 | #include "modules/rtp_rtcp/source/rtp_packet_received.h" |
| 24 | #include "test/gmock.h" |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 25 | |
| 26 | namespace webrtc { |
| 27 | namespace test { |
| 28 | |
Niels Möller | 349ade3 | 2018-11-16 09:50:42 +0100 | [diff] [blame] | 29 | class MockChannelReceive : public voe::ChannelReceiveInterface { |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 30 | public: |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 31 | MOCK_METHOD2(SetNACKStatus, void(bool enable, int max_packets)); |
| 32 | MOCK_METHOD1(RegisterReceiverCongestionControlObjects, |
| 33 | void(PacketRouter* packet_router)); |
| 34 | MOCK_METHOD0(ResetReceiverCongestionControlObjects, void()); |
Niels Möller | 530ead4 | 2018-10-04 14:28:39 +0200 | [diff] [blame] | 35 | MOCK_CONST_METHOD0(GetRTCPStatistics, CallReceiveStatistics()); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 36 | MOCK_CONST_METHOD0(GetNetworkStatistics, NetworkStatistics()); |
| 37 | MOCK_CONST_METHOD0(GetDecodingCallStatistics, AudioDecodingCallStats()); |
| 38 | MOCK_CONST_METHOD0(GetSpeechOutputLevelFullRange, int()); |
| 39 | MOCK_CONST_METHOD0(GetTotalOutputEnergy, double()); |
| 40 | MOCK_CONST_METHOD0(GetTotalOutputDuration, double()); |
| 41 | MOCK_CONST_METHOD0(GetDelayEstimate, uint32_t()); |
| 42 | MOCK_METHOD1(SetSink, void(AudioSinkInterface* sink)); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 43 | MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived& packet)); |
Niels Möller | 8fb1a6a | 2019-03-05 14:29:42 +0100 | [diff] [blame] | 44 | MOCK_METHOD2(ReceivedRTCPPacket, void(const uint8_t* packet, size_t length)); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 45 | MOCK_METHOD1(SetChannelOutputVolumeScaling, void(float scaling)); |
| 46 | MOCK_METHOD2(GetAudioFrameWithInfo, |
| 47 | AudioMixer::Source::AudioFrameInfo(int sample_rate_hz, |
| 48 | AudioFrame* audio_frame)); |
| 49 | MOCK_CONST_METHOD0(PreferredSampleRate, int()); |
Niels Möller | 349ade3 | 2018-11-16 09:50:42 +0100 | [diff] [blame] | 50 | MOCK_METHOD1(SetAssociatedSendChannel, |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 51 | void(const voe::ChannelSendInterface* send_channel)); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 52 | MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t()); |
Niels Möller | 349ade3 | 2018-11-16 09:50:42 +0100 | [diff] [blame] | 53 | MOCK_CONST_METHOD0(GetSyncInfo, absl::optional<Syncable::Info>()); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 54 | MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms)); |
Ruslan Burakov | 3b50f9f | 2019-02-06 09:45:56 +0100 | [diff] [blame] | 55 | MOCK_METHOD1(SetBaseMinimumPlayoutDelayMs, bool(int delay_ms)); |
| 56 | MOCK_CONST_METHOD0(GetBaseMinimumPlayoutDelayMs, int()); |
Fredrik Solenberg | f693bfa | 2018-12-11 12:22:10 +0100 | [diff] [blame] | 57 | MOCK_CONST_METHOD0(GetReceiveCodec, |
| 58 | absl::optional<std::pair<int, SdpAudioFormat>>()); |
Niels Möller | b222f49 | 2018-10-03 16:50:08 +0200 | [diff] [blame] | 59 | MOCK_METHOD1(SetReceiveCodecs, |
| 60 | void(const std::map<int, SdpAudioFormat>& codecs)); |
| 61 | MOCK_CONST_METHOD0(GetSources, std::vector<RtpSource>()); |
| 62 | MOCK_METHOD0(StartPlayout, void()); |
| 63 | MOCK_METHOD0(StopPlayout, void()); |
| 64 | }; |
| 65 | |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 66 | class MockChannelSend : public voe::ChannelSendInterface { |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 67 | public: |
Fredrik Solenberg | 2a87797 | 2017-12-15 16:42:15 +0100 | [diff] [blame] | 68 | // GMock doesn't like move-only types, like std::unique_ptr. |
Niels Möller | 8fb1a6a | 2019-03-05 14:29:42 +0100 | [diff] [blame] | 69 | virtual void SetEncoder(int payload_type, |
Fredrik Solenberg | 2a87797 | 2017-12-15 16:42:15 +0100 | [diff] [blame] | 70 | std::unique_ptr<AudioEncoder> encoder) { |
ossu | 1ffbd6c | 2017-04-06 12:05:04 -0700 | [diff] [blame] | 71 | return SetEncoderForMock(payload_type, &encoder); |
| 72 | } |
| 73 | MOCK_METHOD2(SetEncoderForMock, |
Niels Möller | 8fb1a6a | 2019-03-05 14:29:42 +0100 | [diff] [blame] | 74 | void(int payload_type, std::unique_ptr<AudioEncoder>* encoder)); |
ossu | 20a4b3f | 2017-04-27 02:08:52 -0700 | [diff] [blame] | 75 | MOCK_METHOD1( |
| 76 | ModifyEncoder, |
| 77 | void(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier)); |
Sebastian Jansson | 14a7cf9 | 2019-02-13 15:11:42 +0100 | [diff] [blame] | 78 | MOCK_METHOD1(CallEncoder, |
| 79 | void(rtc::FunctionView<void(AudioEncoder*)> modifier)); |
Amit Hilbuch | 77938e6 | 2018-12-21 09:23:38 -0800 | [diff] [blame] | 80 | MOCK_METHOD3(SetRid, |
| 81 | void(const std::string& rid, |
| 82 | int extension_id, |
| 83 | int repaired_extension_id)); |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 84 | MOCK_METHOD2(SetMid, void(const std::string& mid, int extension_id)); |
Niels Möller | 2681523 | 2018-11-16 09:32:40 +0100 | [diff] [blame] | 85 | MOCK_METHOD1(SetRTCP_CNAME, void(absl::string_view c_name)); |
Johannes Kron | 9190b82 | 2018-10-29 11:22:05 +0100 | [diff] [blame] | 86 | MOCK_METHOD1(SetExtmapAllowMixed, void(bool extmap_allow_mixed)); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 87 | MOCK_METHOD2(SetSendAudioLevelIndicationStatus, void(bool enable, int id)); |
stefan | 3313ec9 | 2016-01-21 06:32:43 -0800 | [diff] [blame] | 88 | MOCK_METHOD1(EnableSendTransportSequenceNumber, void(int id)); |
nisse | b8f9a32 | 2017-03-27 05:36:15 -0700 | [diff] [blame] | 89 | MOCK_METHOD2(RegisterSenderCongestionControlObjects, |
| 90 | void(RtpTransportControllerSendInterface* transport, |
stefan | 7de8d64 | 2017-02-07 07:14:08 -0800 | [diff] [blame] | 91 | RtcpBandwidthObserver* bandwidth_observer)); |
nisse | fdbfdc9 | 2017-03-31 05:44:52 -0700 | [diff] [blame] | 92 | MOCK_METHOD0(ResetSenderCongestionControlObjects, void()); |
Niels Möller | 530ead4 | 2018-10-04 14:28:39 +0200 | [diff] [blame] | 93 | MOCK_CONST_METHOD0(GetRTCPStatistics, CallSendStatistics()); |
solenberg | 358057b | 2015-11-27 10:46:42 -0800 | [diff] [blame] | 94 | MOCK_CONST_METHOD0(GetRemoteRTCPReportBlocks, std::vector<ReportBlock>()); |
ivoc | e1198e0 | 2017-09-08 08:13:19 -0700 | [diff] [blame] | 95 | MOCK_CONST_METHOD0(GetANAStatistics, ANAStats()); |
Niels Möller | ee5ccbc | 2019-03-06 16:47:29 +0100 | [diff] [blame] | 96 | MOCK_METHOD2(RegisterCngPayloadType, |
| 97 | void(int payload_type, int payload_frequency)); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 98 | MOCK_METHOD2(SetSendTelephoneEventPayloadType, |
Niels Möller | 8fb1a6a | 2019-03-05 14:29:42 +0100 | [diff] [blame] | 99 | void(int payload_type, int payload_frequency)); |
solenberg | 8842c3e | 2016-03-11 03:06:41 -0800 | [diff] [blame] | 100 | MOCK_METHOD2(SendTelephoneEventOutband, bool(int event, int duration_ms)); |
Sebastian Jansson | 254d869 | 2018-11-21 19:19:00 +0100 | [diff] [blame] | 101 | MOCK_METHOD1(OnBitrateAllocation, void(BitrateAllocationUpdate update)); |
solenberg | 7602aab | 2016-11-14 11:30:07 -0800 | [diff] [blame] | 102 | MOCK_METHOD1(SetInputMute, void(bool muted)); |
Niels Möller | 8fb1a6a | 2019-03-05 14:29:42 +0100 | [diff] [blame] | 103 | MOCK_METHOD2(ReceivedRTCPPacket, void(const uint8_t* packet, size_t length)); |
Fredrik Solenberg | 2a87797 | 2017-12-15 16:42:15 +0100 | [diff] [blame] | 104 | // GMock doesn't like move-only types, like std::unique_ptr. |
| 105 | virtual void ProcessAndEncodeAudio(std::unique_ptr<AudioFrame> audio_frame) { |
| 106 | ProcessAndEncodeAudioForMock(&audio_frame); |
| 107 | } |
| 108 | MOCK_METHOD1(ProcessAndEncodeAudioForMock, |
| 109 | void(std::unique_ptr<AudioFrame>* audio_frame)); |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 110 | MOCK_METHOD1(SetTransportOverhead, |
| 111 | void(size_t transport_overhead_per_packet)); |
Niels Möller | 848d6d3 | 2018-08-08 10:49:16 +0200 | [diff] [blame] | 112 | MOCK_CONST_METHOD0(GetRtpRtcp, RtpRtcp*()); |
Sebastian Jansson | 359d60a | 2018-10-25 16:22:02 +0200 | [diff] [blame] | 113 | MOCK_CONST_METHOD0(GetBitrate, int()); |
elad.alon | d12a8e1 | 2017-03-23 11:04:48 -0700 | [diff] [blame] | 114 | MOCK_METHOD1(OnTwccBasedUplinkPacketLossRate, void(float packet_loss_rate)); |
elad.alon | dadb4dc | 2017-03-23 15:29:50 -0700 | [diff] [blame] | 115 | MOCK_METHOD1(OnRecoverableUplinkPacketLossRate, |
| 116 | void(float recoverable_packet_loss_rate)); |
Niels Möller | dced9f6 | 2018-11-19 10:27:07 +0100 | [diff] [blame] | 117 | MOCK_CONST_METHOD0(GetRTT, int64_t()); |
Fredrik Solenberg | aaedf75 | 2017-12-18 13:09:12 +0100 | [diff] [blame] | 118 | MOCK_METHOD0(StartSend, void()); |
| 119 | MOCK_METHOD0(StopSend, void()); |
Benjamin Wright | 78410ad | 2018-10-25 09:52:57 -0700 | [diff] [blame] | 120 | MOCK_METHOD1( |
| 121 | SetFrameEncryptor, |
| 122 | void(rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor)); |
solenberg | 1372508 | 2015-11-25 08:16:52 -0800 | [diff] [blame] | 123 | }; |
| 124 | } // namespace test |
| 125 | } // namespace webrtc |
| 126 | |
Fredrik Solenberg | a8b7c7f | 2018-01-17 11:18:31 +0100 | [diff] [blame] | 127 | #endif // AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ |