blob: 1084b4330c589090f48c34fd0f5f26bd5710fa57 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org813e4b02012-03-01 18:34:25 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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_VOICE_ENGINE_CHANNEL_H
12#define WEBRTC_VOICE_ENGINE_CHANNEL_H
13
turaj@webrtc.org6388c3e2013-02-12 21:42:18 +000014#include "webrtc/common_audio/resampler/include/resampler.h"
15#include "webrtc/common_types.h"
16#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
17#include "webrtc/modules/audio_conference_mixer/interface/audio_conference_mixer_defines.h"
18#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
19#include "webrtc/modules/utility/interface/file_player.h"
20#include "webrtc/modules/utility/interface/file_recorder.h"
21#include "webrtc/system_wrappers/interface/scoped_ptr.h"
22#include "webrtc/voice_engine/dtmf_inband.h"
23#include "webrtc/voice_engine/dtmf_inband_queue.h"
24#include "webrtc/voice_engine/include/voe_audio_processing.h"
25#include "webrtc/voice_engine/include/voe_network.h"
26#include "webrtc/voice_engine/level_indicator.h"
27#include "webrtc/voice_engine/shared_data.h"
28#include "webrtc/voice_engine/voice_engine_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000029
niklase@google.com470e71d2011-07-07 08:21:25 +000030#ifdef WEBRTC_DTMF_DETECTION
31#include "voe_dtmf.h" // TelephoneEventDetectionMethods, TelephoneEventObserver
32#endif
33
34namespace webrtc
35{
36class CriticalSectionWrapper;
37class ProcessThread;
38class AudioDeviceModule;
39class RtpRtcp;
40class FileWrapper;
41class RtpDump;
42class VoiceEngineObserver;
43class VoEMediaProcess;
44class VoERTPObserver;
45class VoERTCPObserver;
46
47struct CallStatistics;
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +000048struct ReportBlock;
49struct SenderInfo;
niklase@google.com470e71d2011-07-07 08:21:25 +000050
51namespace voe
52{
53class Statistics;
54class TransmitMixer;
55class OutputMixer;
56
57
58class Channel:
59 public RtpData,
60 public RtpFeedback,
61 public RtcpFeedback,
niklase@google.com470e71d2011-07-07 08:21:25 +000062 public FileCallback, // receiving notification from file player & recorder
63 public Transport,
64 public RtpAudioFeedback,
65 public AudioPacketizationCallback, // receive encoded packets from the ACM
66 public ACMVADCallback, // receive voice activity from the ACM
niklase@google.com470e71d2011-07-07 08:21:25 +000067 public MixerParticipant // supplies output mixer with audio frames
68{
69public:
70 enum {KNumSocketThreads = 1};
71 enum {KNumberOfSocketBuffers = 8};
niklase@google.com470e71d2011-07-07 08:21:25 +000072public:
73 virtual ~Channel();
74 static WebRtc_Word32 CreateChannel(Channel*& channel,
75 const WebRtc_Word32 channelId,
76 const WebRtc_UWord32 instanceId);
77 Channel(const WebRtc_Word32 channelId, const WebRtc_UWord32 instanceId);
78 WebRtc_Word32 Init();
79 WebRtc_Word32 SetEngineInformation(
80 Statistics& engineStatistics,
81 OutputMixer& outputMixer,
82 TransmitMixer& transmitMixer,
83 ProcessThread& moduleProcessThread,
84 AudioDeviceModule& audioDeviceModule,
85 VoiceEngineObserver* voiceEngineObserver,
86 CriticalSectionWrapper* callbackCritSect);
87 WebRtc_Word32 UpdateLocalTimeStamp();
88
89public:
90 // API methods
91
92 // VoEBase
93 WebRtc_Word32 StartPlayout();
94 WebRtc_Word32 StopPlayout();
95 WebRtc_Word32 StartSend();
96 WebRtc_Word32 StopSend();
97 WebRtc_Word32 StartReceiving();
98 WebRtc_Word32 StopReceiving();
99
niklase@google.com470e71d2011-07-07 08:21:25 +0000100 WebRtc_Word32 SetNetEQPlayoutMode(NetEqModes mode);
101 WebRtc_Word32 GetNetEQPlayoutMode(NetEqModes& mode);
niklase@google.com470e71d2011-07-07 08:21:25 +0000102 WebRtc_Word32 SetOnHoldStatus(bool enable, OnHoldModes mode);
103 WebRtc_Word32 GetOnHoldStatus(bool& enabled, OnHoldModes& mode);
104 WebRtc_Word32 RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
105 WebRtc_Word32 DeRegisterVoiceEngineObserver();
106
107 // VoECodec
108 WebRtc_Word32 GetSendCodec(CodecInst& codec);
109 WebRtc_Word32 GetRecCodec(CodecInst& codec);
110 WebRtc_Word32 SetSendCodec(const CodecInst& codec);
111 WebRtc_Word32 SetVADStatus(bool enableVAD, ACMVADMode mode,
112 bool disableDTX);
113 WebRtc_Word32 GetVADStatus(bool& enabledVAD, ACMVADMode& mode,
114 bool& disabledDTX);
115 WebRtc_Word32 SetRecPayloadType(const CodecInst& codec);
116 WebRtc_Word32 GetRecPayloadType(CodecInst& codec);
117 WebRtc_Word32 SetAMREncFormat(AmrMode mode);
118 WebRtc_Word32 SetAMRDecFormat(AmrMode mode);
119 WebRtc_Word32 SetAMRWbEncFormat(AmrMode mode);
120 WebRtc_Word32 SetAMRWbDecFormat(AmrMode mode);
121 WebRtc_Word32 SetSendCNPayloadType(int type, PayloadFrequencies frequency);
122 WebRtc_Word32 SetISACInitTargetRate(int rateBps, bool useFixedFrameSize);
123 WebRtc_Word32 SetISACMaxRate(int rateBps);
124 WebRtc_Word32 SetISACMaxPayloadSize(int sizeBytes);
125
turaj@webrtc.org42259e72012-12-11 02:15:12 +0000126 // VoE dual-streaming.
127 int SetSecondarySendCodec(const CodecInst& codec, int red_payload_type);
128 void RemoveSecondarySendCodec();
129 int GetSecondarySendCodec(CodecInst* codec);
130
niklase@google.com470e71d2011-07-07 08:21:25 +0000131 // VoENetwork
132 WebRtc_Word32 RegisterExternalTransport(Transport& transport);
133 WebRtc_Word32 DeRegisterExternalTransport();
134 WebRtc_Word32 ReceivedRTPPacket(const WebRtc_Word8* data,
135 WebRtc_Word32 length);
136 WebRtc_Word32 ReceivedRTCPPacket(const WebRtc_Word8* data,
137 WebRtc_Word32 length);
niklase@google.com470e71d2011-07-07 08:21:25 +0000138 WebRtc_Word32 SetPacketTimeoutNotification(bool enable, int timeoutSeconds);
139 WebRtc_Word32 GetPacketTimeoutNotification(bool& enabled,
140 int& timeoutSeconds);
141 WebRtc_Word32 RegisterDeadOrAliveObserver(VoEConnectionObserver& observer);
142 WebRtc_Word32 DeRegisterDeadOrAliveObserver();
143 WebRtc_Word32 SetPeriodicDeadOrAliveStatus(bool enable,
144 int sampleTimeSeconds);
145 WebRtc_Word32 GetPeriodicDeadOrAliveStatus(bool& enabled,
146 int& sampleTimeSeconds);
pwestin@webrtc.org684f0572013-03-13 23:20:57 +0000147
niklase@google.com470e71d2011-07-07 08:21:25 +0000148 // VoEFile
149 int StartPlayingFileLocally(const char* fileName, const bool loop,
150 const FileFormats format,
151 const int startPosition,
152 const float volumeScaling,
153 const int stopPosition,
154 const CodecInst* codecInst);
155 int StartPlayingFileLocally(InStream* stream, const FileFormats format,
156 const int startPosition,
157 const float volumeScaling,
158 const int stopPosition,
159 const CodecInst* codecInst);
160 int StopPlayingFileLocally();
161 int IsPlayingFileLocally() const;
braveyao@webrtc.orgab129902012-06-04 03:26:39 +0000162 int RegisterFilePlayingToMixer();
niklase@google.com470e71d2011-07-07 08:21:25 +0000163 int ScaleLocalFilePlayout(const float scale);
164 int GetLocalPlayoutPosition(int& positionMs);
165 int StartPlayingFileAsMicrophone(const char* fileName, const bool loop,
166 const FileFormats format,
167 const int startPosition,
168 const float volumeScaling,
169 const int stopPosition,
170 const CodecInst* codecInst);
171 int StartPlayingFileAsMicrophone(InStream* stream,
172 const FileFormats format,
173 const int startPosition,
174 const float volumeScaling,
175 const int stopPosition,
176 const CodecInst* codecInst);
177 int StopPlayingFileAsMicrophone();
178 int IsPlayingFileAsMicrophone() const;
179 int ScaleFileAsMicrophonePlayout(const float scale);
180 int StartRecordingPlayout(const char* fileName, const CodecInst* codecInst);
181 int StartRecordingPlayout(OutStream* stream, const CodecInst* codecInst);
182 int StopRecordingPlayout();
183
184 void SetMixWithMicStatus(bool mix);
185
186 // VoEExternalMediaProcessing
187 int RegisterExternalMediaProcessing(ProcessingTypes type,
188 VoEMediaProcess& processObject);
189 int DeRegisterExternalMediaProcessing(ProcessingTypes type);
roosa@google.com1b60ceb2012-12-12 23:00:29 +0000190 int SetExternalMixing(bool enabled);
niklase@google.com470e71d2011-07-07 08:21:25 +0000191
192 // VoEVolumeControl
193 int GetSpeechOutputLevel(WebRtc_UWord32& level) const;
194 int GetSpeechOutputLevelFullRange(WebRtc_UWord32& level) const;
195 int SetMute(const bool enable);
196 bool Mute() const;
197 int SetOutputVolumePan(float left, float right);
198 int GetOutputVolumePan(float& left, float& right) const;
199 int SetChannelOutputVolumeScaling(float scaling);
200 int GetChannelOutputVolumeScaling(float& scaling) const;
201
202 // VoECallReport
203 void ResetDeadOrAliveCounters();
204 int ResetRTCPStatistics();
205 int GetRoundTripTimeSummary(StatVal& delaysMs) const;
206 int GetDeadOrAliveCounters(int& countDead, int& countAlive) const;
207
208 // VoENetEqStats
209 int GetNetworkStatistics(NetworkStatistics& stats);
niklase@google.com470e71d2011-07-07 08:21:25 +0000210
211 // VoEVideoSync
212 int GetDelayEstimate(int& delayMs) const;
turaj@webrtc.org6388c3e2013-02-12 21:42:18 +0000213 int SetInitialPlayoutDelay(int delay_ms);
niklase@google.com470e71d2011-07-07 08:21:25 +0000214 int SetMinimumPlayoutDelay(int delayMs);
215 int GetPlayoutTimestamp(unsigned int& timestamp);
216 int SetInitTimestamp(unsigned int timestamp);
217 int SetInitSequenceNumber(short sequenceNumber);
218
219 // VoEVideoSyncExtended
220 int GetRtpRtcp(RtpRtcp* &rtpRtcpModule) const;
221
222 // VoEEncryption
niklase@google.com470e71d2011-07-07 08:21:25 +0000223 int RegisterExternalEncryption(Encryption& encryption);
224 int DeRegisterExternalEncryption();
225
226 // VoEDtmf
227 int SendTelephoneEventOutband(unsigned char eventCode, int lengthMs,
228 int attenuationDb, bool playDtmfEvent);
229 int SendTelephoneEventInband(unsigned char eventCode, int lengthMs,
230 int attenuationDb, bool playDtmfEvent);
231 int SetDtmfPlayoutStatus(bool enable);
232 bool DtmfPlayoutStatus() const;
233 int SetSendTelephoneEventPayloadType(unsigned char type);
234 int GetSendTelephoneEventPayloadType(unsigned char& type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000235
236 // VoEAudioProcessingImpl
237 int UpdateRxVadDetection(AudioFrame& audioFrame);
238 int RegisterRxVadObserver(VoERxVadCallback &observer);
239 int DeRegisterRxVadObserver();
240 int VoiceActivityIndicator(int &activity);
241#ifdef WEBRTC_VOICE_ENGINE_AGC
242 int SetRxAgcStatus(const bool enable, const AgcModes mode);
243 int GetRxAgcStatus(bool& enabled, AgcModes& mode);
244 int SetRxAgcConfig(const AgcConfig config);
245 int GetRxAgcConfig(AgcConfig& config);
246#endif
247#ifdef WEBRTC_VOICE_ENGINE_NR
248 int SetRxNsStatus(const bool enable, const NsModes mode);
249 int GetRxNsStatus(bool& enabled, NsModes& mode);
250#endif
251
252 // VoERTP_RTCP
253 int RegisterRTPObserver(VoERTPObserver& observer);
254 int DeRegisterRTPObserver();
255 int RegisterRTCPObserver(VoERTCPObserver& observer);
256 int DeRegisterRTCPObserver();
257 int SetLocalSSRC(unsigned int ssrc);
258 int GetLocalSSRC(unsigned int& ssrc);
259 int GetRemoteSSRC(unsigned int& ssrc);
260 int GetRemoteCSRCs(unsigned int arrCSRC[15]);
261 int SetRTPAudioLevelIndicationStatus(bool enable, unsigned char ID);
262 int GetRTPAudioLevelIndicationStatus(bool& enable, unsigned char& ID);
263 int SetRTCPStatus(bool enable);
264 int GetRTCPStatus(bool& enabled);
265 int SetRTCP_CNAME(const char cName[256]);
266 int GetRTCP_CNAME(char cName[256]);
267 int GetRemoteRTCP_CNAME(char cName[256]);
268 int GetRemoteRTCPData(unsigned int& NTPHigh, unsigned int& NTPLow,
269 unsigned int& timestamp,
270 unsigned int& playoutTimestamp, unsigned int* jitter,
271 unsigned short* fractionLost);
272 int SendApplicationDefinedRTCPPacket(const unsigned char subType,
273 unsigned int name, const char* data,
274 unsigned short dataLengthInBytes);
275 int GetRTPStatistics(unsigned int& averageJitterMs,
276 unsigned int& maxJitterMs,
277 unsigned int& discardedPackets);
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000278 int GetRemoteRTCPSenderInfo(SenderInfo* sender_info);
279 int GetRemoteRTCPReportBlocks(std::vector<ReportBlock>* report_blocks);
niklase@google.com470e71d2011-07-07 08:21:25 +0000280 int GetRTPStatistics(CallStatistics& stats);
281 int SetFECStatus(bool enable, int redPayloadtype);
282 int GetFECStatus(bool& enabled, int& redPayloadtype);
niklase@google.com470e71d2011-07-07 08:21:25 +0000283 int StartRTPDump(const char fileNameUTF8[1024], RTPDirections direction);
284 int StopRTPDump(RTPDirections direction);
285 bool RTPDumpIsActive(RTPDirections direction);
286 int InsertExtraRTPPacket(unsigned char payloadType, bool markerBit,
287 const char* payloadData,
288 unsigned short payloadSize);
roosa@google.com0870f022012-12-12 21:31:41 +0000289 uint32_t LastRemoteTimeStamp() { return _lastRemoteTimeStamp; }
niklase@google.com470e71d2011-07-07 08:21:25 +0000290
291public:
292 // From AudioPacketizationCallback in the ACM
293 WebRtc_Word32 SendData(FrameType frameType,
294 WebRtc_UWord8 payloadType,
295 WebRtc_UWord32 timeStamp,
296 const WebRtc_UWord8* payloadData,
297 WebRtc_UWord16 payloadSize,
298 const RTPFragmentationHeader* fragmentation);
299 // From ACMVADCallback in the ACM
300 WebRtc_Word32 InFrameType(WebRtc_Word16 frameType);
301
niklase@google.com470e71d2011-07-07 08:21:25 +0000302public:
303 WebRtc_Word32 OnRxVadDetected(const int vadDecision);
304
305public:
306 // From RtpData in the RTP/RTCP module
307 WebRtc_Word32 OnReceivedPayloadData(const WebRtc_UWord8* payloadData,
308 const WebRtc_UWord16 payloadSize,
309 const WebRtcRTPHeader* rtpHeader);
310
311public:
312 // From RtpFeedback in the RTP/RTCP module
313 WebRtc_Word32 OnInitializeDecoder(
314 const WebRtc_Word32 id,
315 const WebRtc_Word8 payloadType,
leozwang@webrtc.org813e4b02012-03-01 18:34:25 +0000316 const char payloadName[RTP_PAYLOAD_NAME_SIZE],
xians@google.com0b0665a2011-08-08 08:18:44 +0000317 const int frequency,
niklase@google.com470e71d2011-07-07 08:21:25 +0000318 const WebRtc_UWord8 channels,
319 const WebRtc_UWord32 rate);
320
321 void OnPacketTimeout(const WebRtc_Word32 id);
322
323 void OnReceivedPacket(const WebRtc_Word32 id,
324 const RtpRtcpPacketType packetType);
325
326 void OnPeriodicDeadOrAlive(const WebRtc_Word32 id,
327 const RTPAliveType alive);
328
329 void OnIncomingSSRCChanged(const WebRtc_Word32 id,
330 const WebRtc_UWord32 SSRC);
331
332 void OnIncomingCSRCChanged(const WebRtc_Word32 id,
333 const WebRtc_UWord32 CSRC, const bool added);
334
335public:
336 // From RtcpFeedback in the RTP/RTCP module
niklase@google.com470e71d2011-07-07 08:21:25 +0000337 void OnApplicationDataReceived(const WebRtc_Word32 id,
338 const WebRtc_UWord8 subType,
339 const WebRtc_UWord32 name,
340 const WebRtc_UWord16 length,
341 const WebRtc_UWord8* data);
342
niklase@google.com470e71d2011-07-07 08:21:25 +0000343public:
344 // From RtpAudioFeedback in the RTP/RTCP module
345 void OnReceivedTelephoneEvent(const WebRtc_Word32 id,
346 const WebRtc_UWord8 event,
347 const bool endOfEvent);
348
349 void OnPlayTelephoneEvent(const WebRtc_Word32 id,
350 const WebRtc_UWord8 event,
351 const WebRtc_UWord16 lengthMs,
352 const WebRtc_UWord8 volume);
353
354public:
niklase@google.com470e71d2011-07-07 08:21:25 +0000355 // From Transport (called by the RTP/RTCP module)
356 int SendPacket(int /*channel*/, const void *data, int len);
357 int SendRTCPPacket(int /*channel*/, const void *data, int len);
358
359public:
360 // From MixerParticipant
361 WebRtc_Word32 GetAudioFrame(const WebRtc_Word32 id,
362 AudioFrame& audioFrame);
363 WebRtc_Word32 NeededFrequency(const WebRtc_Word32 id);
364
365public:
366 // From MonitorObserver
367 void OnPeriodicProcess();
368
369public:
370 // From FileCallback
371 void PlayNotification(const WebRtc_Word32 id,
372 const WebRtc_UWord32 durationMs);
373 void RecordNotification(const WebRtc_Word32 id,
374 const WebRtc_UWord32 durationMs);
375 void PlayFileEnded(const WebRtc_Word32 id);
376 void RecordFileEnded(const WebRtc_Word32 id);
377
378public:
379 WebRtc_UWord32 InstanceId() const
380 {
381 return _instanceId;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000382 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000383 WebRtc_Word32 ChannelId() const
384 {
385 return _channelId;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000386 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000387 bool Playing() const
388 {
389 return _playing;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000390 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000391 bool Sending() const
392 {
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000393 // A lock is needed because |_sending| is accessed by both
394 // TransmitMixer::PrepareDemux() and StartSend()/StopSend(), which
395 // are called by different threads.
mflodman@webrtc.org9a065d12012-03-07 08:12:21 +0000396 CriticalSectionScoped cs(&_callbackCritSect);
niklase@google.com470e71d2011-07-07 08:21:25 +0000397 return _sending;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000398 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000399 bool Receiving() const
400 {
401 return _receiving;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000402 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000403 bool ExternalTransport() const
404 {
405 return _externalTransport;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000406 }
roosa@google.com1b60ceb2012-12-12 23:00:29 +0000407 bool ExternalMixing() const
408 {
409 return _externalMixing;
410 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000411 bool OutputIsOnHold() const
412 {
413 return _outputIsOnHold;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000414 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000415 bool InputIsOnHold() const
416 {
417 return _inputIsOnHold;
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000418 }
andrew@webrtc.orgf81f9f82011-08-19 22:56:22 +0000419 RtpRtcp* RtpRtcpModulePtr() const
niklase@google.com470e71d2011-07-07 08:21:25 +0000420 {
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000421 return _rtpRtcpModule.get();
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000422 }
andrew@webrtc.orgf81f9f82011-08-19 22:56:22 +0000423 WebRtc_Word8 OutputEnergyLevel() const
niklase@google.com470e71d2011-07-07 08:21:25 +0000424 {
425 return _outputAudioLevel.Level();
xians@webrtc.orge07247a2011-11-28 16:31:28 +0000426 }
andrew@webrtc.org755b04a2011-11-15 16:57:56 +0000427 WebRtc_UWord32 Demultiplex(const AudioFrame& audioFrame);
xians@google.com0b0665a2011-08-08 08:18:44 +0000428 WebRtc_UWord32 PrepareEncodeAndSend(int mixingFrequency);
niklase@google.com470e71d2011-07-07 08:21:25 +0000429 WebRtc_UWord32 EncodeAndSend();
430
431private:
432 int InsertInbandDtmfTone();
433 WebRtc_Word32
xians@google.com0b0665a2011-08-08 08:18:44 +0000434 MixOrReplaceAudioWithFile(const int mixingFrequency);
niklase@google.com470e71d2011-07-07 08:21:25 +0000435 WebRtc_Word32 MixAudioWithFile(AudioFrame& audioFrame,
xians@google.com0b0665a2011-08-08 08:18:44 +0000436 const int mixingFrequency);
niklase@google.com470e71d2011-07-07 08:21:25 +0000437 WebRtc_Word32 GetPlayoutTimeStamp(WebRtc_UWord32& playoutTimestamp);
438 void UpdateDeadOrAliveCounters(bool alive);
439 WebRtc_Word32 SendPacketRaw(const void *data, int len, bool RTCP);
440 WebRtc_Word32 UpdatePacketDelay(const WebRtc_UWord32 timestamp,
441 const WebRtc_UWord16 sequenceNumber);
442 void RegisterReceiveCodecsToRTPModule();
443 int ApmProcessRx(AudioFrame& audioFrame);
444
turaj@webrtc.org42259e72012-12-11 02:15:12 +0000445 int SetRedPayloadType(int red_payload_type);
niklase@google.com470e71d2011-07-07 08:21:25 +0000446private:
447 CriticalSectionWrapper& _fileCritSect;
448 CriticalSectionWrapper& _callbackCritSect;
niklase@google.com470e71d2011-07-07 08:21:25 +0000449 WebRtc_UWord32 _instanceId;
450 WebRtc_Word32 _channelId;
451
452private:
pwestin@webrtc.org2853dde2012-05-11 11:08:54 +0000453 scoped_ptr<RtpRtcp> _rtpRtcpModule;
niklase@google.com470e71d2011-07-07 08:21:25 +0000454 AudioCodingModule& _audioCodingModule;
niklase@google.com470e71d2011-07-07 08:21:25 +0000455 RtpDump& _rtpDumpIn;
456 RtpDump& _rtpDumpOut;
457private:
458 AudioLevel _outputAudioLevel;
459 bool _externalTransport;
460 AudioFrame _audioFrame;
461 WebRtc_UWord8 _audioLevel_dBov;
462 FilePlayer* _inputFilePlayerPtr;
463 FilePlayer* _outputFilePlayerPtr;
464 FileRecorder* _outputFileRecorderPtr;
xians@google.com0b0665a2011-08-08 08:18:44 +0000465 int _inputFilePlayerId;
466 int _outputFilePlayerId;
467 int _outputFileRecorderId;
niklase@google.com470e71d2011-07-07 08:21:25 +0000468 bool _inputFilePlaying;
469 bool _outputFilePlaying;
470 bool _outputFileRecording;
471 DtmfInbandQueue _inbandDtmfQueue;
472 DtmfInband _inbandDtmfGenerator;
niklase@google.com470e71d2011-07-07 08:21:25 +0000473 bool _inputExternalMedia;
xians@google.com22963ab2011-08-03 12:40:23 +0000474 bool _outputExternalMedia;
niklase@google.com470e71d2011-07-07 08:21:25 +0000475 VoEMediaProcess* _inputExternalMediaCallbackPtr;
476 VoEMediaProcess* _outputExternalMediaCallbackPtr;
477 WebRtc_UWord8* _encryptionRTPBufferPtr;
478 WebRtc_UWord8* _decryptionRTPBufferPtr;
479 WebRtc_UWord8* _encryptionRTCPBufferPtr;
480 WebRtc_UWord8* _decryptionRTCPBufferPtr;
481 WebRtc_UWord32 _timeStamp;
482 WebRtc_UWord8 _sendTelephoneEventPayloadType;
483 WebRtc_UWord32 _playoutTimeStampRTP;
484 WebRtc_UWord32 _playoutTimeStampRTCP;
485 WebRtc_UWord32 _numberOfDiscardedPackets;
486private:
487 // uses
488 Statistics* _engineStatisticsPtr;
489 OutputMixer* _outputMixerPtr;
490 TransmitMixer* _transmitMixerPtr;
491 ProcessThread* _moduleProcessThreadPtr;
492 AudioDeviceModule* _audioDeviceModulePtr;
493 VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base
494 CriticalSectionWrapper* _callbackCritSectPtr; // owned by base
495 Transport* _transportPtr; // WebRtc socket or external transport
496 Encryption* _encryptionPtr; // WebRtc SRTP or external encryption
andrew@webrtc.org755b04a2011-11-15 16:57:56 +0000497 scoped_ptr<AudioProcessing> _rtpAudioProc;
niklase@google.com470e71d2011-07-07 08:21:25 +0000498 AudioProcessing* _rxAudioProcessingModulePtr; // far end AudioProcessing
niklase@google.com470e71d2011-07-07 08:21:25 +0000499 VoERxVadCallback* _rxVadObserverPtr;
500 WebRtc_Word32 _oldVadDecision;
501 WebRtc_Word32 _sendFrameType; // Send data is voice, 1-voice, 0-otherwise
502 VoERTPObserver* _rtpObserverPtr;
503 VoERTCPObserver* _rtcpObserverPtr;
504private:
505 // VoEBase
506 bool _outputIsOnHold;
507 bool _externalPlayout;
roosa@google.com1b60ceb2012-12-12 23:00:29 +0000508 bool _externalMixing;
niklase@google.com470e71d2011-07-07 08:21:25 +0000509 bool _inputIsOnHold;
510 bool _playing;
511 bool _sending;
512 bool _receiving;
513 bool _mixFileWithMicrophone;
514 bool _rtpObserver;
515 bool _rtcpObserver;
516 // VoEVolumeControl
517 bool _mute;
518 float _panLeft;
519 float _panRight;
520 float _outputGain;
521 // VoEEncryption
522 bool _encrypting;
523 bool _decrypting;
524 // VoEDtmf
525 bool _playOutbandDtmfEvent;
526 bool _playInbandDtmfEvent;
niklase@google.com470e71d2011-07-07 08:21:25 +0000527 // VoeRTP_RTCP
528 WebRtc_UWord8 _extraPayloadType;
529 bool _insertExtraRTPPacket;
530 bool _extraMarkerBit;
531 WebRtc_UWord32 _lastLocalTimeStamp;
roosa@google.com0870f022012-12-12 21:31:41 +0000532 uint32_t _lastRemoteTimeStamp;
niklase@google.com470e71d2011-07-07 08:21:25 +0000533 WebRtc_Word8 _lastPayloadType;
534 bool _includeAudioLevelIndication;
535 // VoENetwork
536 bool _rtpPacketTimedOut;
537 bool _rtpPacketTimeOutIsEnabled;
538 WebRtc_UWord32 _rtpTimeOutSeconds;
539 bool _connectionObserver;
540 VoEConnectionObserver* _connectionObserverPtr;
541 WebRtc_UWord32 _countAliveDetections;
542 WebRtc_UWord32 _countDeadDetections;
543 AudioFrame::SpeechType _outputSpeechType;
544 // VoEVideoSync
545 WebRtc_UWord32 _averageDelayMs;
546 WebRtc_UWord16 _previousSequenceNumber;
547 WebRtc_UWord32 _previousTimestamp;
548 WebRtc_UWord16 _recPacketDelayMs;
549 // VoEAudioProcessing
550 bool _RxVadDetection;
551 bool _rxApmIsEnabled;
552 bool _rxAgcIsEnabled;
553 bool _rxNsIsEnabled;
554};
555
556} // namespace voe
557
558} // namespace webrtc
559
560#endif // WEBRTC_VOICE_ENGINE_CHANNEL_H