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 11 #ifndef AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ 12 #define AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ 13 14 #include <map> 15 #include <memory> 16 #include <string> 17 #include <utility> 18 #include <vector> 19 20 #include "api/test/mock_frame_encryptor.h" 21 #include "audio/channel_receive.h" 22 #include "audio/channel_send.h" 23 #include "modules/rtp_rtcp/source/rtp_packet_received.h" 24 #include "test/gmock.h" 25 26 namespace webrtc { 27 namespace test { 28 29 class MockChannelReceive : public voe::ChannelReceiveInterface { 30 public: 31 MOCK_METHOD(void, SetNACKStatus, (bool enable, int max_packets), (override)); 32 MOCK_METHOD(void, 33 RegisterReceiverCongestionControlObjects, 34 (PacketRouter*), 35 (override)); 36 MOCK_METHOD(void, ResetReceiverCongestionControlObjects, (), (override)); 37 MOCK_METHOD(CallReceiveStatistics, GetRTCPStatistics, (), (const, override)); 38 MOCK_METHOD(NetworkStatistics, GetNetworkStatistics, (), (const, override)); 39 MOCK_METHOD(AudioDecodingCallStats, 40 GetDecodingCallStatistics, 41 (), 42 (const, override)); 43 MOCK_METHOD(int, GetSpeechOutputLevelFullRange, (), (const, override)); 44 MOCK_METHOD(double, GetTotalOutputEnergy, (), (const, override)); 45 MOCK_METHOD(double, GetTotalOutputDuration, (), (const, override)); 46 MOCK_METHOD(uint32_t, GetDelayEstimate, (), (const, override)); 47 MOCK_METHOD(void, SetSink, (AudioSinkInterface*), (override)); 48 MOCK_METHOD(void, OnRtpPacket, (const RtpPacketReceived& packet), (override)); 49 MOCK_METHOD(void, 50 ReceivedRTCPPacket, 51 (const uint8_t*, size_t length), 52 (override)); 53 MOCK_METHOD(void, SetChannelOutputVolumeScaling, (float scaling), (override)); 54 MOCK_METHOD(AudioMixer::Source::AudioFrameInfo, 55 GetAudioFrameWithInfo, 56 (int sample_rate_hz, AudioFrame*), 57 (override)); 58 MOCK_METHOD(int, PreferredSampleRate, (), (const, override)); 59 MOCK_METHOD(void, 60 SetAssociatedSendChannel, 61 (const voe::ChannelSendInterface*), 62 (override)); 63 MOCK_METHOD(bool, 64 GetPlayoutRtpTimestamp, 65 (uint32_t*, int64_t*), 66 (const, override)); 67 MOCK_METHOD(void, 68 SetEstimatedPlayoutNtpTimestampMs, 69 (int64_t ntp_timestamp_ms, int64_t time_ms), 70 (override)); 71 MOCK_METHOD(absl::optional<int64_t>, 72 GetCurrentEstimatedPlayoutNtpTimestampMs, 73 (int64_t now_ms), 74 (const, override)); 75 MOCK_METHOD(absl::optional<Syncable::Info>, 76 GetSyncInfo, 77 (), 78 (const, override)); 79 MOCK_METHOD(void, SetMinimumPlayoutDelay, (int delay_ms), (override)); 80 MOCK_METHOD(bool, SetBaseMinimumPlayoutDelayMs, (int delay_ms), (override)); 81 MOCK_METHOD(int, GetBaseMinimumPlayoutDelayMs, (), (const, override)); 82 MOCK_METHOD((absl::optional<std::pair<int, SdpAudioFormat>>), 83 GetReceiveCodec, 84 (), 85 (const, override)); 86 MOCK_METHOD(void, 87 SetReceiveCodecs, 88 ((const std::map<int, SdpAudioFormat>& codecs)), 89 (override)); 90 MOCK_METHOD(void, StartPlayout, (), (override)); 91 MOCK_METHOD(void, StopPlayout, (), (override)); 92 MOCK_METHOD( 93 void, 94 SetDepacketizerToDecoderFrameTransformer, 95 (rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer), 96 (override)); 97 }; 98 99 class MockChannelSend : public voe::ChannelSendInterface { 100 public: 101 MOCK_METHOD(void, 102 SetEncoder, 103 (int payload_type, std::unique_ptr<AudioEncoder> encoder), 104 (override)); 105 MOCK_METHOD( 106 void, 107 ModifyEncoder, 108 (rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier), 109 (override)); 110 MOCK_METHOD(void, 111 CallEncoder, 112 (rtc::FunctionView<void(AudioEncoder*)> modifier), 113 (override)); 114 MOCK_METHOD(void, SetRTCP_CNAME, (absl::string_view c_name), (override)); 115 MOCK_METHOD(void, 116 SetSendAudioLevelIndicationStatus, 117 (bool enable, int id), 118 (override)); 119 MOCK_METHOD(void, 120 RegisterSenderCongestionControlObjects, 121 (RtpTransportControllerSendInterface*, RtcpBandwidthObserver*), 122 (override)); 123 MOCK_METHOD(void, ResetSenderCongestionControlObjects, (), (override)); 124 MOCK_METHOD(CallSendStatistics, GetRTCPStatistics, (), (const, override)); 125 MOCK_METHOD(std::vector<ReportBlock>, 126 GetRemoteRTCPReportBlocks, 127 (), 128 (const, override)); 129 MOCK_METHOD(ANAStats, GetANAStatistics, (), (const, override)); 130 MOCK_METHOD(void, 131 RegisterCngPayloadType, 132 (int payload_type, int payload_frequency), 133 (override)); 134 MOCK_METHOD(void, 135 SetSendTelephoneEventPayloadType, 136 (int payload_type, int payload_frequency), 137 (override)); 138 MOCK_METHOD(bool, 139 SendTelephoneEventOutband, 140 (int event, int duration_ms), 141 (override)); 142 MOCK_METHOD(void, 143 OnBitrateAllocation, 144 (BitrateAllocationUpdate update), 145 (override)); 146 MOCK_METHOD(void, SetInputMute, (bool muted), (override)); 147 MOCK_METHOD(void, 148 ReceivedRTCPPacket, 149 (const uint8_t*, size_t length), 150 (override)); 151 MOCK_METHOD(void, 152 ProcessAndEncodeAudio, 153 (std::unique_ptr<AudioFrame>), 154 (override)); 155 MOCK_METHOD(RtpRtcpInterface*, GetRtpRtcp, (), (const, override)); 156 MOCK_METHOD(int, GetBitrate, (), (const, override)); 157 MOCK_METHOD(int64_t, GetRTT, (), (const, override)); 158 MOCK_METHOD(void, StartSend, (), (override)); 159 MOCK_METHOD(void, StopSend, (), (override)); 160 MOCK_METHOD(void, 161 SetFrameEncryptor, 162 (rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor), 163 (override)); 164 MOCK_METHOD( 165 void, 166 SetEncoderToPacketizerFrameTransformer, 167 (rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer), 168 (override)); 169 }; 170 } // namespace test 171 } // namespace webrtc 172 173 #endif // AUDIO_MOCK_VOE_CHANNEL_PROXY_H_ 174