mock_voe_channel_proxy.h 6.5 KB

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