2015-11-25 08:16:52 -08:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef TEST_MOCK_VOE_CHANNEL_PROXY_H_
|
|
|
|
|
#define TEST_MOCK_VOE_CHANNEL_PROXY_H_
|
2015-11-25 08:16:52 -08:00
|
|
|
|
|
|
|
|
#include <string>
|
2016-09-30 22:29:43 -07:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
|
|
|
|
#include "test/gmock.h"
|
|
|
|
|
#include "voice_engine/channel_proxy.h"
|
2015-11-25 08:16:52 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
|
|
|
|
class MockVoEChannelProxy : public voe::ChannelProxy {
|
|
|
|
|
public:
|
2017-04-06 12:05:04 -07:00
|
|
|
// GTest doesn't like move-only types, like std::unique_ptr
|
|
|
|
|
bool SetEncoder(int payload_type,
|
|
|
|
|
std::unique_ptr<AudioEncoder> encoder) {
|
|
|
|
|
return SetEncoderForMock(payload_type, &encoder);
|
|
|
|
|
}
|
|
|
|
|
MOCK_METHOD2(SetEncoderForMock,
|
|
|
|
|
bool(int payload_type,
|
|
|
|
|
std::unique_ptr<AudioEncoder>* encoder));
|
2017-04-27 02:08:52 -07:00
|
|
|
MOCK_METHOD1(
|
|
|
|
|
ModifyEncoder,
|
|
|
|
|
void(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier));
|
2015-11-25 08:16:52 -08:00
|
|
|
MOCK_METHOD1(SetRTCPStatus, void(bool enable));
|
|
|
|
|
MOCK_METHOD1(SetLocalSSRC, void(uint32_t ssrc));
|
|
|
|
|
MOCK_METHOD1(SetRTCP_CNAME, void(const std::string& c_name));
|
2016-06-14 10:02:41 -07:00
|
|
|
MOCK_METHOD2(SetNACKStatus, void(bool enable, int max_packets));
|
2015-11-27 10:46:42 -08:00
|
|
|
MOCK_METHOD2(SetSendAudioLevelIndicationStatus, void(bool enable, int id));
|
|
|
|
|
MOCK_METHOD2(SetReceiveAudioLevelIndicationStatus, void(bool enable, int id));
|
2016-01-21 06:32:43 -08:00
|
|
|
MOCK_METHOD1(EnableSendTransportSequenceNumber, void(int id));
|
|
|
|
|
MOCK_METHOD1(EnableReceiveTransportSequenceNumber, void(int id));
|
2017-03-27 05:36:15 -07:00
|
|
|
MOCK_METHOD2(RegisterSenderCongestionControlObjects,
|
|
|
|
|
void(RtpTransportControllerSendInterface* transport,
|
2017-02-07 07:14:08 -08:00
|
|
|
RtcpBandwidthObserver* bandwidth_observer));
|
2016-02-01 04:39:55 -08:00
|
|
|
MOCK_METHOD1(RegisterReceiverCongestionControlObjects,
|
|
|
|
|
void(PacketRouter* packet_router));
|
2017-03-31 05:44:52 -07:00
|
|
|
MOCK_METHOD0(ResetSenderCongestionControlObjects, void());
|
|
|
|
|
MOCK_METHOD0(ResetReceiverCongestionControlObjects, void());
|
2015-11-27 10:46:42 -08:00
|
|
|
MOCK_CONST_METHOD0(GetRTCPStatistics, CallStatistics());
|
|
|
|
|
MOCK_CONST_METHOD0(GetRemoteRTCPReportBlocks, std::vector<ReportBlock>());
|
|
|
|
|
MOCK_CONST_METHOD0(GetNetworkStatistics, NetworkStatistics());
|
|
|
|
|
MOCK_CONST_METHOD0(GetDecodingCallStatistics, AudioDecodingCallStats());
|
2017-09-08 08:13:19 -07:00
|
|
|
MOCK_CONST_METHOD0(GetANAStatistics, ANAStats());
|
2017-03-08 01:52:20 -08:00
|
|
|
MOCK_CONST_METHOD0(GetSpeechOutputLevel, int());
|
|
|
|
|
MOCK_CONST_METHOD0(GetSpeechOutputLevelFullRange, int());
|
2017-07-14 12:17:49 -07:00
|
|
|
MOCK_CONST_METHOD0(GetTotalOutputEnergy, double());
|
|
|
|
|
MOCK_CONST_METHOD0(GetTotalOutputDuration, double());
|
2015-11-27 10:46:42 -08:00
|
|
|
MOCK_CONST_METHOD0(GetDelayEstimate, uint32_t());
|
2016-11-17 05:25:37 -08:00
|
|
|
MOCK_METHOD2(SetSendTelephoneEventPayloadType, bool(int payload_type,
|
|
|
|
|
int payload_frequency));
|
2016-03-11 03:06:41 -08:00
|
|
|
MOCK_METHOD2(SendTelephoneEventOutband, bool(int event, int duration_ms));
|
2016-11-30 04:47:39 -08:00
|
|
|
MOCK_METHOD2(SetBitrate, void(int bitrate_bps, int64_t probing_interval_ms));
|
2016-06-17 08:30:54 -07:00
|
|
|
// TODO(solenberg): Talk the compiler into accepting this mock method:
|
|
|
|
|
// MOCK_METHOD1(SetSink, void(std::unique_ptr<AudioSinkInterface> sink));
|
2016-11-14 11:30:07 -08:00
|
|
|
MOCK_METHOD1(SetInputMute, void(bool muted));
|
2017-09-29 06:00:28 -07:00
|
|
|
MOCK_METHOD1(RegisterTransport, void(Transport* transport));
|
2017-02-21 06:28:10 -08:00
|
|
|
MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived& packet));
|
2016-04-29 00:57:13 -07:00
|
|
|
MOCK_METHOD2(ReceivedRTCPPacket, bool(const uint8_t* packet, size_t length));
|
2016-06-13 07:34:51 -07:00
|
|
|
MOCK_CONST_METHOD0(GetAudioDecoderFactory,
|
|
|
|
|
const rtc::scoped_refptr<AudioDecoderFactory>&());
|
2016-06-17 08:30:54 -07:00
|
|
|
MOCK_METHOD1(SetChannelOutputVolumeScaling, void(float scaling));
|
2016-07-04 07:06:55 -07:00
|
|
|
MOCK_METHOD1(SetRtcEventLog, void(RtcEventLog* event_log));
|
2016-11-30 07:51:13 -08:00
|
|
|
MOCK_METHOD1(SetRtcpRttStats, void(RtcpRttStats* rtcp_rtt_stats));
|
2016-11-14 11:30:07 -08:00
|
|
|
MOCK_METHOD2(GetAudioFrameWithInfo,
|
|
|
|
|
AudioMixer::Source::AudioFrameInfo(int sample_rate_hz,
|
|
|
|
|
AudioFrame* audio_frame));
|
2017-09-22 06:48:10 -07:00
|
|
|
MOCK_CONST_METHOD0(PreferredSampleRate, int());
|
2016-11-14 11:30:07 -08:00
|
|
|
MOCK_METHOD1(SetTransportOverhead, void(int transport_overhead_per_packet));
|
|
|
|
|
MOCK_METHOD1(AssociateSendChannel,
|
|
|
|
|
void(const ChannelProxy& send_channel_proxy));
|
|
|
|
|
MOCK_METHOD0(DisassociateSendChannel, void());
|
2017-01-31 03:58:40 -08:00
|
|
|
MOCK_CONST_METHOD2(GetRtpRtcp, void(RtpRtcp** rtp_rtcp,
|
|
|
|
|
RtpReceiver** rtp_receiver));
|
|
|
|
|
MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t());
|
|
|
|
|
MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms));
|
2017-02-06 12:53:57 -08:00
|
|
|
MOCK_CONST_METHOD1(GetRecCodec, bool(CodecInst* codec_inst));
|
2017-03-27 07:15:49 -07:00
|
|
|
MOCK_METHOD1(SetReceiveCodecs,
|
|
|
|
|
void(const std::map<int, SdpAudioFormat>& codecs));
|
2017-03-23 11:04:48 -07:00
|
|
|
MOCK_METHOD1(OnTwccBasedUplinkPacketLossRate, void(float packet_loss_rate));
|
2017-03-23 15:29:50 -07:00
|
|
|
MOCK_METHOD1(OnRecoverableUplinkPacketLossRate,
|
|
|
|
|
void(float recoverable_packet_loss_rate));
|
Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )
Reason for revert:
Re-land, reverting did not fix bug.
https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/292084c3765d9f3ee406ca2ec86eae206b540053
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: https://chromium.googlesource.com/external/webrtc/+/fbcc5cb3869d1370008e40f24fc03ac8fb69c675
TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122
Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
2017-04-10 07:39:05 -07:00
|
|
|
MOCK_CONST_METHOD0(GetSources, std::vector<RtpSource>());
|
2015-11-25 08:16:52 -08:00
|
|
|
};
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // TEST_MOCK_VOE_CHANNEL_PROXY_H_
|