• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 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 WEBRTC_MODULES_RTP_RTCP_MOCKS_MOCK_RTP_RTCP_H_
12 #define WEBRTC_MODULES_RTP_RTCP_MOCKS_MOCK_RTP_RTCP_H_
13 
14 #include "testing/gmock/include/gmock/gmock.h"
15 
16 #include "webrtc/modules/interface/module.h"
17 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
18 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
19 
20 namespace webrtc {
21 
22 class MockRtpData : public RtpData {
23  public:
24   MOCK_METHOD3(OnReceivedPayloadData,
25                int32_t(const uint8_t* payloadData,
26                        const uint16_t payloadSize,
27                        const WebRtcRTPHeader* rtpHeader));
28 
29   MOCK_METHOD2(OnRecoveredPacket,
30                bool(const uint8_t* packet, int packet_length));
31 };
32 
33 class MockRtpRtcp : public RtpRtcp {
34  public:
35   MOCK_METHOD1(ChangeUniqueId,
36       int32_t(const int32_t id));
37   MOCK_METHOD1(RegisterDefaultModule,
38       int32_t(RtpRtcp* module));
39   MOCK_METHOD0(DeRegisterDefaultModule,
40       int32_t());
41   MOCK_METHOD0(DefaultModuleRegistered,
42       bool());
43   MOCK_METHOD0(NumberChildModules,
44       uint32_t());
45   MOCK_METHOD1(RegisterSyncModule,
46       int32_t(RtpRtcp* module));
47   MOCK_METHOD0(DeRegisterSyncModule,
48       int32_t());
49   MOCK_METHOD2(IncomingRtcpPacket,
50       int32_t(const uint8_t* incomingPacket, uint16_t packetLength));
51   MOCK_METHOD1(SetRemoteSSRC, void(const uint32_t ssrc));
52   MOCK_METHOD4(IncomingAudioNTP,
53       int32_t(const uint32_t audioReceivedNTPsecs,
54               const uint32_t audioReceivedNTPfrac,
55               const uint32_t audioRTCPArrivalTimeSecs,
56               const uint32_t audioRTCPArrivalTimeFrac));
57   MOCK_METHOD0(InitSender,
58       int32_t());
59   MOCK_METHOD1(RegisterSendTransport,
60       int32_t(Transport* outgoingTransport));
61   MOCK_METHOD1(SetMaxTransferUnit,
62       int32_t(const uint16_t size));
63   MOCK_METHOD3(SetTransportOverhead,
64       int32_t(const bool TCP, const bool IPV6,
65               const uint8_t authenticationOverhead));
66   MOCK_CONST_METHOD0(MaxPayloadLength,
67       uint16_t());
68   MOCK_CONST_METHOD0(MaxDataPayloadLength,
69       uint16_t());
70   MOCK_METHOD1(RegisterSendPayload,
71       int32_t(const CodecInst& voiceCodec));
72   MOCK_METHOD1(RegisterSendPayload,
73       int32_t(const VideoCodec& videoCodec));
74   MOCK_METHOD1(DeRegisterSendPayload,
75       int32_t(const int8_t payloadType));
76   MOCK_METHOD2(RegisterSendRtpHeaderExtension,
77       int32_t(const RTPExtensionType type, const uint8_t id));
78   MOCK_METHOD1(DeregisterSendRtpHeaderExtension,
79       int32_t(const RTPExtensionType type));
80   MOCK_CONST_METHOD0(StartTimestamp,
81       uint32_t());
82   MOCK_METHOD1(SetStartTimestamp,
83       int32_t(const uint32_t timestamp));
84   MOCK_CONST_METHOD0(SequenceNumber,
85       uint16_t());
86   MOCK_METHOD1(SetSequenceNumber,
87       int32_t(const uint16_t seq));
88   MOCK_METHOD2(SetRtpStateForSsrc,
89                void(uint32_t ssrc, const RtpState& rtp_state));
90   MOCK_METHOD2(GetRtpStateForSsrc, bool(uint32_t ssrc, RtpState* rtp_state));
91   MOCK_CONST_METHOD0(SSRC,
92       uint32_t());
93   MOCK_METHOD1(SetSSRC,
94       void(const uint32_t ssrc));
95   MOCK_CONST_METHOD1(CSRCs,
96       int32_t(uint32_t arrOfCSRC[kRtpCsrcSize]));
97   MOCK_METHOD2(SetCSRCs,
98       int32_t(const uint32_t arrOfCSRC[kRtpCsrcSize], const uint8_t arrLength));
99   MOCK_METHOD1(SetCSRCStatus,
100       int32_t(const bool include));
101   MOCK_METHOD1(SetRTXSendStatus,
102       void(int modes));
103   MOCK_CONST_METHOD3(RTXSendStatus,
104       void(int* modes, uint32_t* ssrc, int* payload_type));
105   MOCK_METHOD1(SetRtxSsrc,
106       void(uint32_t));
107   MOCK_METHOD1(SetRtxSendPayloadType,
108       void(int));
109   MOCK_METHOD1(SetSendingStatus,
110       int32_t(const bool sending));
111   MOCK_CONST_METHOD0(Sending,
112       bool());
113   MOCK_METHOD1(SetSendingMediaStatus,
114       int32_t(const bool sending));
115   MOCK_CONST_METHOD0(SendingMedia,
116       bool());
117   MOCK_CONST_METHOD4(BitrateSent,
118       void(uint32_t* totalRate, uint32_t* videoRate, uint32_t* fecRate, uint32_t* nackRate));
119   MOCK_METHOD1(RegisterVideoBitrateObserver, void(BitrateStatisticsObserver*));
120   MOCK_CONST_METHOD0(GetVideoBitrateObserver, BitrateStatisticsObserver*(void));
121   MOCK_CONST_METHOD1(EstimatedReceiveBandwidth,
122       int(uint32_t* available_bandwidth));
123   MOCK_METHOD8(SendOutgoingData,
124       int32_t(const FrameType frameType,
125               const int8_t payloadType,
126               const uint32_t timeStamp,
127               int64_t capture_time_ms,
128               const uint8_t* payloadData,
129               const uint32_t payloadSize,
130               const RTPFragmentationHeader* fragmentation,
131               const RTPVideoHeader* rtpVideoHdr));
132   MOCK_METHOD4(TimeToSendPacket,
133       bool(uint32_t ssrc, uint16_t sequence_number, int64_t capture_time_ms,
134            bool retransmission));
135   MOCK_METHOD1(TimeToSendPadding,
136       int(int bytes));
137   MOCK_CONST_METHOD2(GetSendSideDelay,
138       bool(int* avg_send_delay_ms, int* max_send_delay_ms));
139   MOCK_METHOD3(RegisterRtcpObservers,
140       void(RtcpIntraFrameObserver* intraFrameCallback,
141            RtcpBandwidthObserver* bandwidthCallback,
142            RtcpFeedback* callback));
143   MOCK_CONST_METHOD0(RTCP,
144       RTCPMethod());
145   MOCK_METHOD1(SetRTCPStatus,
146       int32_t(const RTCPMethod method));
147   MOCK_METHOD1(SetCNAME,
148       int32_t(const char cName[RTCP_CNAME_SIZE]));
149   MOCK_CONST_METHOD2(RemoteCNAME,
150       int32_t(const uint32_t remoteSSRC,
151               char cName[RTCP_CNAME_SIZE]));
152   MOCK_CONST_METHOD5(RemoteNTP,
153       int32_t(uint32_t *ReceivedNTPsecs,
154               uint32_t *ReceivedNTPfrac,
155               uint32_t *RTCPArrivalTimeSecs,
156               uint32_t *RTCPArrivalTimeFrac,
157               uint32_t *rtcp_timestamp));
158   MOCK_METHOD2(AddMixedCNAME,
159       int32_t(const uint32_t SSRC,
160               const char cName[RTCP_CNAME_SIZE]));
161   MOCK_METHOD1(RemoveMixedCNAME,
162       int32_t(const uint32_t SSRC));
163   MOCK_CONST_METHOD5(RTT,
164       int32_t(const uint32_t remoteSSRC, uint16_t* RTT, uint16_t* avgRTT, uint16_t* minRTT, uint16_t* maxRTT));
165   MOCK_METHOD1(ResetRTT,
166       int32_t(const uint32_t remoteSSRC));
167   MOCK_METHOD1(SendRTCP,
168       int32_t(uint32_t rtcpPacketType));
169   MOCK_METHOD1(SendRTCPReferencePictureSelection,
170       int32_t(const uint64_t pictureID));
171   MOCK_METHOD1(SendRTCPSliceLossIndication,
172       int32_t(const uint8_t pictureID));
173   MOCK_METHOD0(ResetSendDataCountersRTP,
174       int32_t());
175   MOCK_CONST_METHOD2(DataCountersRTP,
176       int32_t(uint32_t *bytesSent, uint32_t *packetsSent));
177   MOCK_METHOD1(RemoteRTCPStat,
178       int32_t(RTCPSenderInfo* senderInfo));
179   MOCK_CONST_METHOD1(RemoteRTCPStat,
180       int32_t(std::vector<RTCPReportBlock>* receiveBlocks));
181   MOCK_METHOD2(AddRTCPReportBlock,
182       int32_t(const uint32_t SSRC, const RTCPReportBlock* receiveBlock));
183   MOCK_METHOD1(RemoveRTCPReportBlock,
184       int32_t(const uint32_t SSRC));
185   MOCK_CONST_METHOD2(GetRtcpPacketTypeCounters,
186       void(RtcpPacketTypeCounter*, RtcpPacketTypeCounter*));
187   MOCK_METHOD4(SetRTCPApplicationSpecificData,
188       int32_t(const uint8_t subType, const uint32_t name, const uint8_t* data, const uint16_t length));
189   MOCK_METHOD1(SetRTCPVoIPMetrics,
190       int32_t(const RTCPVoIPMetric* VoIPMetric));
191   MOCK_METHOD1(SetRtcpXrRrtrStatus,
192       void(bool enable));
193   MOCK_CONST_METHOD0(RtcpXrRrtrStatus,
194       bool());
195   MOCK_CONST_METHOD0(REMB,
196       bool());
197   MOCK_METHOD1(SetREMBStatus,
198       int32_t(const bool enable));
199   MOCK_METHOD3(SetREMBData,
200       int32_t(const uint32_t bitrate, const uint8_t numberOfSSRC, const uint32_t* SSRC));
201   MOCK_CONST_METHOD0(IJ,
202       bool());
203   MOCK_METHOD1(SetIJStatus,
204       int32_t(const bool));
205   MOCK_CONST_METHOD0(TMMBR,
206       bool());
207   MOCK_METHOD1(SetTMMBRStatus,
208       int32_t(const bool enable));
209   MOCK_METHOD1(OnBandwidthEstimateUpdate,
210       void(uint16_t bandWidthKbit));
211   MOCK_CONST_METHOD0(NACK,
212       NACKMethod());
213   MOCK_METHOD2(SetNACKStatus,
214       int32_t(const NACKMethod method, int oldestSequenceNumberToNack));
215   MOCK_CONST_METHOD0(SelectiveRetransmissions,
216       int());
217   MOCK_METHOD1(SetSelectiveRetransmissions,
218       int(uint8_t settings));
219   MOCK_METHOD2(SendNACK,
220       int32_t(const uint16_t* nackList, const uint16_t size));
221   MOCK_METHOD2(SetStorePacketsStatus,
222       int32_t(const bool enable, const uint16_t numberToStore));
223   MOCK_CONST_METHOD0(StorePackets, bool());
224   MOCK_METHOD1(RegisterSendChannelRtcpStatisticsCallback,
225                void(RtcpStatisticsCallback*));
226   MOCK_METHOD0(GetSendChannelRtcpStatisticsCallback,
227                RtcpStatisticsCallback*());
228   MOCK_METHOD1(RegisterAudioCallback,
229       int32_t(RtpAudioFeedback* messagesCallback));
230   MOCK_METHOD1(SetAudioPacketSize,
231       int32_t(const uint16_t packetSizeSamples));
232   MOCK_CONST_METHOD1(SendTelephoneEventActive,
233       bool(int8_t& telephoneEvent));
234   MOCK_METHOD3(SendTelephoneEventOutband,
235       int32_t(const uint8_t key, const uint16_t time_ms, const uint8_t level));
236   MOCK_METHOD1(SetSendREDPayloadType,
237       int32_t(const int8_t payloadType));
238   MOCK_CONST_METHOD1(SendREDPayloadType,
239       int32_t(int8_t& payloadType));
240   MOCK_METHOD2(SetRTPAudioLevelIndicationStatus,
241       int32_t(const bool enable, const uint8_t ID));
242   MOCK_CONST_METHOD2(GetRTPAudioLevelIndicationStatus,
243       int32_t(bool& enable, uint8_t& ID));
244   MOCK_METHOD1(SetAudioLevel,
245       int32_t(const uint8_t level_dBov));
246   MOCK_METHOD1(SetCameraDelay,
247       int32_t(const int32_t delayMS));
248   MOCK_METHOD1(SetTargetSendBitrate,
249       void(const std::vector<uint32_t>& stream_bitrates));
250   MOCK_METHOD3(SetGenericFECStatus,
251       int32_t(const bool enable, const uint8_t payloadTypeRED, const uint8_t payloadTypeFEC));
252   MOCK_METHOD3(GenericFECStatus,
253       int32_t(bool& enable, uint8_t& payloadTypeRED, uint8_t& payloadTypeFEC));
254   MOCK_METHOD2(SetFecParameters,
255       int32_t(const FecProtectionParams* delta_params,
256               const FecProtectionParams* key_params));
257   MOCK_METHOD1(SetKeyFrameRequestMethod,
258       int32_t(const KeyFrameRequestMethod method));
259   MOCK_METHOD0(RequestKeyFrame,
260       int32_t());
261   MOCK_CONST_METHOD3(Version,
262       int32_t(char* version, uint32_t& remaining_buffer_in_bytes, uint32_t& position));
263   MOCK_METHOD0(TimeUntilNextProcess,
264         int32_t());
265   MOCK_METHOD0(Process,
266         int32_t());
267   MOCK_METHOD1(RegisterSendFrameCountObserver,
268       void(FrameCountObserver*));
269   MOCK_CONST_METHOD0(GetSendFrameCountObserver,
270       FrameCountObserver*(void));
271   MOCK_METHOD1(RegisterSendChannelRtpStatisticsCallback,
272       void(StreamDataCountersCallback*));
273   MOCK_CONST_METHOD0(GetSendChannelRtpStatisticsCallback,
274       StreamDataCountersCallback*(void));
275   // Members.
276   unsigned int remote_ssrc_;
277 };
278 
279 }  // namespace webrtc
280 
281 #endif  // WEBRTC_MODULES_RTP_RTCP_MOCKS_MOCK_RTP_RTCP_H_
282