Files
platform-external-webrtc/audio/mock_voe_channel_proxy.h
Tomas Gunnarsson f25761d798 Remove dependency from RtpRtcp on the Module interface.
The 'Module' part of the implementation must not be
called via the RtpRtcp interface, but is rather a part of
the contract with ProcessThread. That in turn is an
implementation detail for how timers are currently implemented
in the default implementation.

Along the way I'm deprecating away the factory function which
was inside the interface and tied it to one specific implementation.
Instead, I'm moving that to the implementation itself and down the
line, we don't have to go through it if we just want to create an
instance of the class.

The key change is in rtp_rtcp.h and the new rtp_rtcp_interface.h
header file (things moved from rtp_rtcp.h), the rest falls from that.

Change-Id: I294f13e947b9e3e4e649400ee94a11a81e8071ce
Bug: webrtc:11581
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176419
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31440}
2020-06-04 08:11:21 +00:00

174 lines
6.5 KiB
C++

/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef AUDIO_MOCK_VOE_CHANNEL_PROXY_H_
#define AUDIO_MOCK_VOE_CHANNEL_PROXY_H_
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "api/test/mock_frame_encryptor.h"
#include "audio/channel_receive.h"
#include "audio/channel_send.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
#include "test/gmock.h"
namespace webrtc {
namespace test {
class MockChannelReceive : public voe::ChannelReceiveInterface {
public:
MOCK_METHOD(void, SetNACKStatus, (bool enable, int max_packets), (override));
MOCK_METHOD(void,
RegisterReceiverCongestionControlObjects,
(PacketRouter*),
(override));
MOCK_METHOD(void, ResetReceiverCongestionControlObjects, (), (override));
MOCK_METHOD(CallReceiveStatistics, GetRTCPStatistics, (), (const, override));
MOCK_METHOD(NetworkStatistics, GetNetworkStatistics, (), (const, override));
MOCK_METHOD(AudioDecodingCallStats,
GetDecodingCallStatistics,
(),
(const, override));
MOCK_METHOD(int, GetSpeechOutputLevelFullRange, (), (const, override));
MOCK_METHOD(double, GetTotalOutputEnergy, (), (const, override));
MOCK_METHOD(double, GetTotalOutputDuration, (), (const, override));
MOCK_METHOD(uint32_t, GetDelayEstimate, (), (const, override));
MOCK_METHOD(void, SetSink, (AudioSinkInterface*), (override));
MOCK_METHOD(void, OnRtpPacket, (const RtpPacketReceived& packet), (override));
MOCK_METHOD(void,
ReceivedRTCPPacket,
(const uint8_t*, size_t length),
(override));
MOCK_METHOD(void, SetChannelOutputVolumeScaling, (float scaling), (override));
MOCK_METHOD(AudioMixer::Source::AudioFrameInfo,
GetAudioFrameWithInfo,
(int sample_rate_hz, AudioFrame*),
(override));
MOCK_METHOD(int, PreferredSampleRate, (), (const, override));
MOCK_METHOD(void,
SetAssociatedSendChannel,
(const voe::ChannelSendInterface*),
(override));
MOCK_METHOD(bool,
GetPlayoutRtpTimestamp,
(uint32_t*, int64_t*),
(const, override));
MOCK_METHOD(void,
SetEstimatedPlayoutNtpTimestampMs,
(int64_t ntp_timestamp_ms, int64_t time_ms),
(override));
MOCK_METHOD(absl::optional<int64_t>,
GetCurrentEstimatedPlayoutNtpTimestampMs,
(int64_t now_ms),
(const, override));
MOCK_METHOD(absl::optional<Syncable::Info>,
GetSyncInfo,
(),
(const, override));
MOCK_METHOD(void, SetMinimumPlayoutDelay, (int delay_ms), (override));
MOCK_METHOD(bool, SetBaseMinimumPlayoutDelayMs, (int delay_ms), (override));
MOCK_METHOD(int, GetBaseMinimumPlayoutDelayMs, (), (const, override));
MOCK_METHOD((absl::optional<std::pair<int, SdpAudioFormat>>),
GetReceiveCodec,
(),
(const, override));
MOCK_METHOD(void,
SetReceiveCodecs,
((const std::map<int, SdpAudioFormat>& codecs)),
(override));
MOCK_METHOD(void, StartPlayout, (), (override));
MOCK_METHOD(void, StopPlayout, (), (override));
MOCK_METHOD(
void,
SetDepacketizerToDecoderFrameTransformer,
(rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer),
(override));
};
class MockChannelSend : public voe::ChannelSendInterface {
public:
MOCK_METHOD(void,
SetEncoder,
(int payload_type, std::unique_ptr<AudioEncoder> encoder),
(override));
MOCK_METHOD(
void,
ModifyEncoder,
(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier),
(override));
MOCK_METHOD(void,
CallEncoder,
(rtc::FunctionView<void(AudioEncoder*)> modifier),
(override));
MOCK_METHOD(void, SetRTCP_CNAME, (absl::string_view c_name), (override));
MOCK_METHOD(void,
SetSendAudioLevelIndicationStatus,
(bool enable, int id),
(override));
MOCK_METHOD(void,
RegisterSenderCongestionControlObjects,
(RtpTransportControllerSendInterface*, RtcpBandwidthObserver*),
(override));
MOCK_METHOD(void, ResetSenderCongestionControlObjects, (), (override));
MOCK_METHOD(CallSendStatistics, GetRTCPStatistics, (), (const, override));
MOCK_METHOD(std::vector<ReportBlock>,
GetRemoteRTCPReportBlocks,
(),
(const, override));
MOCK_METHOD(ANAStats, GetANAStatistics, (), (const, override));
MOCK_METHOD(void,
RegisterCngPayloadType,
(int payload_type, int payload_frequency),
(override));
MOCK_METHOD(void,
SetSendTelephoneEventPayloadType,
(int payload_type, int payload_frequency),
(override));
MOCK_METHOD(bool,
SendTelephoneEventOutband,
(int event, int duration_ms),
(override));
MOCK_METHOD(void,
OnBitrateAllocation,
(BitrateAllocationUpdate update),
(override));
MOCK_METHOD(void, SetInputMute, (bool muted), (override));
MOCK_METHOD(void,
ReceivedRTCPPacket,
(const uint8_t*, size_t length),
(override));
MOCK_METHOD(void,
ProcessAndEncodeAudio,
(std::unique_ptr<AudioFrame>),
(override));
MOCK_METHOD(RtpRtcpInterface*, GetRtpRtcp, (), (const, override));
MOCK_METHOD(int, GetBitrate, (), (const, override));
MOCK_METHOD(int64_t, GetRTT, (), (const, override));
MOCK_METHOD(void, StartSend, (), (override));
MOCK_METHOD(void, StopSend, (), (override));
MOCK_METHOD(void,
SetFrameEncryptor,
(rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor),
(override));
MOCK_METHOD(
void,
SetEncoderToPacketizerFrameTransformer,
(rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer),
(override));
};
} // namespace test
} // namespace webrtc
#endif // AUDIO_MOCK_VOE_CHANNEL_PROXY_H_