mock_voe_channel_proxy.h 6.5 KB

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