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_VOICE_ENGINE_CHANNEL_H_
12#define WEBRTC_VOICE_ENGINE_CHANNEL_H_
13
14#include "webrtc/audio/audio_sink.h"
15#include "webrtc/base/criticalsection.h"
16#include "webrtc/base/scoped_ptr.h"
17#include "webrtc/common_audio/resampler/include/push_resampler.h"
18#include "webrtc/common_types.h"
19#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
20#include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_defines.h"
21#include "webrtc/modules/audio_processing/rms_level.h"
22#include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h"
23#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
24#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
25#include "webrtc/modules/utility/include/file_player.h"
26#include "webrtc/modules/utility/include/file_recorder.h"
27#include "webrtc/voice_engine/dtmf_inband.h"
28#include "webrtc/voice_engine/dtmf_inband_queue.h"
29#include "webrtc/voice_engine/include/voe_audio_processing.h"
30#include "webrtc/voice_engine/include/voe_network.h"
31#include "webrtc/voice_engine/level_indicator.h"
32#include "webrtc/voice_engine/network_predictor.h"
33#include "webrtc/voice_engine/shared_data.h"
34#include "webrtc/voice_engine/voice_engine_defines.h"
35
36#ifdef WEBRTC_DTMF_DETECTION
37// TelephoneEventDetectionMethods, TelephoneEventObserver
38#include "webrtc/voice_engine/include/voe_dtmf.h"
39#endif
40
41namespace rtc {
42
43class TimestampWrapAroundHandler;
44}
45
46namespace webrtc {
47
48class AudioDeviceModule;
49class Config;
50class CriticalSectionWrapper;
51class FileWrapper;
52class PacketRouter;
53class ProcessThread;
54class ReceiveStatistics;
55class RemoteNtpTimeEstimator;
56class RtcEventLog;
57class RTPPayloadRegistry;
58class RtpReceiver;
59class RTPReceiverAudio;
60class RtpRtcp;
61class TelephoneEventHandler;
62class VoEMediaProcess;
63class VoERTPObserver;
64class VoiceEngineObserver;
65
66struct CallStatistics;
67struct ReportBlock;
68struct SenderInfo;
69
70namespace voe {
71
72class OutputMixer;
73class RtpPacketSenderProxy;
74class Statistics;
75class StatisticsProxy;
76class TransportFeedbackProxy;
77class TransmitMixer;
78class TransportSequenceNumberProxy;
79class VoERtcpObserver;
80
81// Helper class to simplify locking scheme for members that are accessed from
82// multiple threads.
83// Example: a member can be set on thread T1 and read by an internal audio
84// thread T2. Accessing the member via this class ensures that we are
85// safe and also avoid TSan v2 warnings.
86class ChannelState {
87 public:
88    struct State {
89        State() : rx_apm_is_enabled(false),
90                  input_external_media(false),
91                  output_file_playing(false),
92                  input_file_playing(false),
93                  playing(false),
94                  sending(false),
95                  receiving(false) {}
96
97        bool rx_apm_is_enabled;
98        bool input_external_media;
99        bool output_file_playing;
100        bool input_file_playing;
101        bool playing;
102        bool sending;
103        bool receiving;
104    };
105
106    ChannelState() : lock_(CriticalSectionWrapper::CreateCriticalSection()) {
107    }
108    virtual ~ChannelState() {}
109
110    void Reset() {
111        CriticalSectionScoped lock(lock_.get());
112        state_ = State();
113    }
114
115    State Get() const {
116        CriticalSectionScoped lock(lock_.get());
117        return state_;
118    }
119
120    void SetRxApmIsEnabled(bool enable) {
121        CriticalSectionScoped lock(lock_.get());
122        state_.rx_apm_is_enabled = enable;
123    }
124
125    void SetInputExternalMedia(bool enable) {
126        CriticalSectionScoped lock(lock_.get());
127        state_.input_external_media = enable;
128    }
129
130    void SetOutputFilePlaying(bool enable) {
131        CriticalSectionScoped lock(lock_.get());
132        state_.output_file_playing = enable;
133    }
134
135    void SetInputFilePlaying(bool enable) {
136        CriticalSectionScoped lock(lock_.get());
137        state_.input_file_playing = enable;
138    }
139
140    void SetPlaying(bool enable) {
141        CriticalSectionScoped lock(lock_.get());
142        state_.playing = enable;
143    }
144
145    void SetSending(bool enable) {
146        CriticalSectionScoped lock(lock_.get());
147        state_.sending = enable;
148    }
149
150    void SetReceiving(bool enable) {
151        CriticalSectionScoped lock(lock_.get());
152        state_.receiving = enable;
153    }
154
155private:
156 rtc::scoped_ptr<CriticalSectionWrapper> lock_;
157    State state_;
158};
159
160class Channel:
161    public RtpData,
162    public RtpFeedback,
163    public FileCallback, // receiving notification from file player & recorder
164    public Transport,
165    public RtpAudioFeedback,
166    public AudioPacketizationCallback, // receive encoded packets from the ACM
167    public ACMVADCallback, // receive voice activity from the ACM
168    public MixerParticipant // supplies output mixer with audio frames
169{
170public:
171    friend class VoERtcpObserver;
172
173    enum {KNumSocketThreads = 1};
174    enum {KNumberOfSocketBuffers = 8};
175    virtual ~Channel();
176    static int32_t CreateChannel(Channel*& channel,
177                                 int32_t channelId,
178                                 uint32_t instanceId,
179                                 RtcEventLog* const event_log,
180                                 const Config& config);
181    Channel(int32_t channelId,
182            uint32_t instanceId,
183            RtcEventLog* const event_log,
184            const Config& config);
185    int32_t Init();
186    int32_t SetEngineInformation(
187        Statistics& engineStatistics,
188        OutputMixer& outputMixer,
189        TransmitMixer& transmitMixer,
190        ProcessThread& moduleProcessThread,
191        AudioDeviceModule& audioDeviceModule,
192        VoiceEngineObserver* voiceEngineObserver,
193        CriticalSectionWrapper* callbackCritSect);
194    int32_t UpdateLocalTimeStamp();
195
196    void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink);
197
198    // API methods
199
200    // VoEBase
201    int32_t StartPlayout();
202    int32_t StopPlayout();
203    int32_t StartSend();
204    int32_t StopSend();
205    int32_t StartReceiving();
206    int32_t StopReceiving();
207
208    int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
209    int32_t DeRegisterVoiceEngineObserver();
210
211    // VoECodec
212    int32_t GetSendCodec(CodecInst& codec);
213    int32_t GetRecCodec(CodecInst& codec);
214    int32_t SetSendCodec(const CodecInst& codec);
215    void SetBitRate(int bitrate_bps);
216    int32_t SetVADStatus(bool enableVAD, ACMVADMode mode, bool disableDTX);
217    int32_t GetVADStatus(bool& enabledVAD, ACMVADMode& mode, bool& disabledDTX);
218    int32_t SetRecPayloadType(const CodecInst& codec);
219    int32_t GetRecPayloadType(CodecInst& codec);
220    int32_t SetSendCNPayloadType(int type, PayloadFrequencies frequency);
221    int SetOpusMaxPlaybackRate(int frequency_hz);
222    int SetOpusDtx(bool enable_dtx);
223
224    // VoENetwork
225    int32_t RegisterExternalTransport(Transport& transport);
226    int32_t DeRegisterExternalTransport();
227    int32_t ReceivedRTPPacket(const int8_t* data, size_t length,
228                              const PacketTime& packet_time);
229    int32_t ReceivedRTCPPacket(const int8_t* data, size_t length);
230
231    // VoEFile
232    int StartPlayingFileLocally(const char* fileName, bool loop,
233                                FileFormats format,
234                                int startPosition,
235                                float volumeScaling,
236                                int stopPosition,
237                                const CodecInst* codecInst);
238    int StartPlayingFileLocally(InStream* stream, FileFormats format,
239                                int startPosition,
240                                float volumeScaling,
241                                int stopPosition,
242                                const CodecInst* codecInst);
243    int StopPlayingFileLocally();
244    int IsPlayingFileLocally() const;
245    int RegisterFilePlayingToMixer();
246    int StartPlayingFileAsMicrophone(const char* fileName, bool loop,
247                                     FileFormats format,
248                                     int startPosition,
249                                     float volumeScaling,
250                                     int stopPosition,
251                                     const CodecInst* codecInst);
252    int StartPlayingFileAsMicrophone(InStream* stream,
253                                     FileFormats format,
254                                     int startPosition,
255                                     float volumeScaling,
256                                     int stopPosition,
257                                     const CodecInst* codecInst);
258    int StopPlayingFileAsMicrophone();
259    int IsPlayingFileAsMicrophone() const;
260    int StartRecordingPlayout(const char* fileName, const CodecInst* codecInst);
261    int StartRecordingPlayout(OutStream* stream, const CodecInst* codecInst);
262    int StopRecordingPlayout();
263
264    void SetMixWithMicStatus(bool mix);
265
266    // VoEExternalMediaProcessing
267    int RegisterExternalMediaProcessing(ProcessingTypes type,
268                                        VoEMediaProcess& processObject);
269    int DeRegisterExternalMediaProcessing(ProcessingTypes type);
270    int SetExternalMixing(bool enabled);
271
272    // VoEVolumeControl
273    int GetSpeechOutputLevel(uint32_t& level) const;
274    int GetSpeechOutputLevelFullRange(uint32_t& level) const;
275    int SetMute(bool enable);
276    bool Mute() const;
277    int SetOutputVolumePan(float left, float right);
278    int GetOutputVolumePan(float& left, float& right) const;
279    int SetChannelOutputVolumeScaling(float scaling);
280    int GetChannelOutputVolumeScaling(float& scaling) const;
281
282    // VoENetEqStats
283    int GetNetworkStatistics(NetworkStatistics& stats);
284    void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const;
285
286    // VoEVideoSync
287    bool GetDelayEstimate(int* jitter_buffer_delay_ms,
288                          int* playout_buffer_delay_ms) const;
289    uint32_t GetDelayEstimate() const;
290    int LeastRequiredDelayMs() const;
291    int SetMinimumPlayoutDelay(int delayMs);
292    int GetPlayoutTimestamp(unsigned int& timestamp);
293    int SetInitTimestamp(unsigned int timestamp);
294    int SetInitSequenceNumber(short sequenceNumber);
295
296    // VoEVideoSyncExtended
297    int GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const;
298
299    // VoEDtmf
300    int SendTelephoneEventOutband(unsigned char eventCode, int lengthMs,
301                                  int attenuationDb, bool playDtmfEvent);
302    int SendTelephoneEventInband(unsigned char eventCode, int lengthMs,
303                                 int attenuationDb, bool playDtmfEvent);
304    int SetSendTelephoneEventPayloadType(unsigned char type);
305    int GetSendTelephoneEventPayloadType(unsigned char& type);
306
307    // VoEAudioProcessingImpl
308    int UpdateRxVadDetection(AudioFrame& audioFrame);
309    int RegisterRxVadObserver(VoERxVadCallback &observer);
310    int DeRegisterRxVadObserver();
311    int VoiceActivityIndicator(int &activity);
312#ifdef WEBRTC_VOICE_ENGINE_AGC
313    int SetRxAgcStatus(bool enable, AgcModes mode);
314    int GetRxAgcStatus(bool& enabled, AgcModes& mode);
315    int SetRxAgcConfig(AgcConfig config);
316    int GetRxAgcConfig(AgcConfig& config);
317#endif
318#ifdef WEBRTC_VOICE_ENGINE_NR
319    int SetRxNsStatus(bool enable, NsModes mode);
320    int GetRxNsStatus(bool& enabled, NsModes& mode);
321#endif
322
323    // VoERTP_RTCP
324    int SetLocalSSRC(unsigned int ssrc);
325    int GetLocalSSRC(unsigned int& ssrc);
326    int GetRemoteSSRC(unsigned int& ssrc);
327    int SetSendAudioLevelIndicationStatus(bool enable, unsigned char id);
328    int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id);
329    int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id);
330    int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id);
331    void EnableSendTransportSequenceNumber(int id);
332
333    void SetCongestionControlObjects(
334        RtpPacketSender* rtp_packet_sender,
335        TransportFeedbackObserver* transport_feedback_observer,
336        PacketRouter* packet_router);
337
338    void SetRTCPStatus(bool enable);
339    int GetRTCPStatus(bool& enabled);
340    int SetRTCP_CNAME(const char cName[256]);
341    int GetRemoteRTCP_CNAME(char cName[256]);
342    int GetRemoteRTCPData(unsigned int& NTPHigh, unsigned int& NTPLow,
343                          unsigned int& timestamp,
344                          unsigned int& playoutTimestamp, unsigned int* jitter,
345                          unsigned short* fractionLost);
346    int SendApplicationDefinedRTCPPacket(unsigned char subType,
347                                         unsigned int name, const char* data,
348                                         unsigned short dataLengthInBytes);
349    int GetRTPStatistics(unsigned int& averageJitterMs,
350                         unsigned int& maxJitterMs,
351                         unsigned int& discardedPackets);
352    int GetRemoteRTCPReportBlocks(std::vector<ReportBlock>* report_blocks);
353    int GetRTPStatistics(CallStatistics& stats);
354    int SetREDStatus(bool enable, int redPayloadtype);
355    int GetREDStatus(bool& enabled, int& redPayloadtype);
356    int SetCodecFECStatus(bool enable);
357    bool GetCodecFECStatus();
358    void SetNACKStatus(bool enable, int maxNumberOfPackets);
359
360    // From AudioPacketizationCallback in the ACM
361    int32_t SendData(FrameType frameType,
362                     uint8_t payloadType,
363                     uint32_t timeStamp,
364                     const uint8_t* payloadData,
365                     size_t payloadSize,
366                     const RTPFragmentationHeader* fragmentation) override;
367
368    // From ACMVADCallback in the ACM
369    int32_t InFrameType(FrameType frame_type) override;
370
371    int32_t OnRxVadDetected(int vadDecision);
372
373    // From RtpData in the RTP/RTCP module
374    int32_t OnReceivedPayloadData(const uint8_t* payloadData,
375                                  size_t payloadSize,
376                                  const WebRtcRTPHeader* rtpHeader) override;
377    bool OnRecoveredPacket(const uint8_t* packet,
378                           size_t packet_length) override;
379
380    // From RtpFeedback in the RTP/RTCP module
381    int32_t OnInitializeDecoder(int8_t payloadType,
382                                const char payloadName[RTP_PAYLOAD_NAME_SIZE],
383                                int frequency,
384                                size_t channels,
385                                uint32_t rate) override;
386    void OnIncomingSSRCChanged(uint32_t ssrc) override;
387    void OnIncomingCSRCChanged(uint32_t CSRC, bool added) override;
388
389    // From RtpAudioFeedback in the RTP/RTCP module
390    void OnPlayTelephoneEvent(uint8_t event,
391                              uint16_t lengthMs,
392                              uint8_t volume) override;
393
394    // From Transport (called by the RTP/RTCP module)
395    bool SendRtp(const uint8_t* data,
396                 size_t len,
397                 const PacketOptions& packet_options) override;
398    bool SendRtcp(const uint8_t* data, size_t len) override;
399
400    // From MixerParticipant
401    int32_t GetAudioFrame(int32_t id, AudioFrame* audioFrame) override;
402    int32_t NeededFrequency(int32_t id) const override;
403
404    // From FileCallback
405    void PlayNotification(int32_t id, uint32_t durationMs) override;
406    void RecordNotification(int32_t id, uint32_t durationMs) override;
407    void PlayFileEnded(int32_t id) override;
408    void RecordFileEnded(int32_t id) override;
409
410    uint32_t InstanceId() const
411    {
412        return _instanceId;
413    }
414    int32_t ChannelId() const
415    {
416        return _channelId;
417    }
418    bool Playing() const
419    {
420        return channel_state_.Get().playing;
421    }
422    bool Sending() const
423    {
424        return channel_state_.Get().sending;
425    }
426    bool Receiving() const
427    {
428        return channel_state_.Get().receiving;
429    }
430    bool ExternalTransport() const
431    {
432        CriticalSectionScoped cs(&_callbackCritSect);
433        return _externalTransport;
434    }
435    bool ExternalMixing() const
436    {
437        return _externalMixing;
438    }
439    RtpRtcp* RtpRtcpModulePtr() const
440    {
441        return _rtpRtcpModule.get();
442    }
443    int8_t OutputEnergyLevel() const
444    {
445        return _outputAudioLevel.Level();
446    }
447    uint32_t Demultiplex(const AudioFrame& audioFrame);
448    // Demultiplex the data to the channel's |_audioFrame|. The difference
449    // between this method and the overloaded method above is that |audio_data|
450    // does not go through transmit_mixer and APM.
451    void Demultiplex(const int16_t* audio_data,
452                     int sample_rate,
453                     size_t number_of_frames,
454                     size_t number_of_channels);
455    uint32_t PrepareEncodeAndSend(int mixingFrequency);
456    uint32_t EncodeAndSend();
457
458    // Associate to a send channel.
459    // Used for obtaining RTT for a receive-only channel.
460    void set_associate_send_channel(const ChannelOwner& channel) {
461      assert(_channelId != channel.channel()->ChannelId());
462      CriticalSectionScoped lock(assoc_send_channel_lock_.get());
463      associate_send_channel_ = channel;
464    }
465
466    // Disassociate a send channel if it was associated.
467    void DisassociateSendChannel(int channel_id);
468
469protected:
470    void OnIncomingFractionLoss(int fraction_lost);
471
472private:
473    bool ReceivePacket(const uint8_t* packet, size_t packet_length,
474                       const RTPHeader& header, bool in_order);
475    bool HandleRtxPacket(const uint8_t* packet,
476                         size_t packet_length,
477                         const RTPHeader& header);
478    bool IsPacketInOrder(const RTPHeader& header) const;
479    bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const;
480    int ResendPackets(const uint16_t* sequence_numbers, int length);
481    int InsertInbandDtmfTone();
482    int32_t MixOrReplaceAudioWithFile(int mixingFrequency);
483    int32_t MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency);
484    void UpdatePlayoutTimestamp(bool rtcp);
485    void UpdatePacketDelay(uint32_t timestamp,
486                           uint16_t sequenceNumber);
487    void RegisterReceiveCodecsToRTPModule();
488
489    int SetRedPayloadType(int red_payload_type);
490    int SetSendRtpHeaderExtension(bool enable, RTPExtensionType type,
491                                  unsigned char id);
492
493    int32_t GetPlayoutFrequency();
494    int64_t GetRTT(bool allow_associate_channel) const;
495
496    CriticalSectionWrapper& _fileCritSect;
497    CriticalSectionWrapper& _callbackCritSect;
498    CriticalSectionWrapper& volume_settings_critsect_;
499    uint32_t _instanceId;
500    int32_t _channelId;
501
502    ChannelState channel_state_;
503
504    RtcEventLog* const event_log_;
505
506    rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
507    rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
508    rtc::scoped_ptr<ReceiveStatistics> rtp_receive_statistics_;
509    rtc::scoped_ptr<StatisticsProxy> statistics_proxy_;
510    rtc::scoped_ptr<RtpReceiver> rtp_receiver_;
511    TelephoneEventHandler* telephone_event_handler_;
512    rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule;
513    rtc::scoped_ptr<AudioCodingModule> audio_coding_;
514    rtc::scoped_ptr<AudioSinkInterface> audio_sink_;
515    AudioLevel _outputAudioLevel;
516    bool _externalTransport;
517    AudioFrame _audioFrame;
518    // Downsamples to the codec rate if necessary.
519    PushResampler<int16_t> input_resampler_;
520    FilePlayer* _inputFilePlayerPtr;
521    FilePlayer* _outputFilePlayerPtr;
522    FileRecorder* _outputFileRecorderPtr;
523    int _inputFilePlayerId;
524    int _outputFilePlayerId;
525    int _outputFileRecorderId;
526    bool _outputFileRecording;
527    DtmfInbandQueue _inbandDtmfQueue;
528    DtmfInband _inbandDtmfGenerator;
529    bool _outputExternalMedia;
530    VoEMediaProcess* _inputExternalMediaCallbackPtr;
531    VoEMediaProcess* _outputExternalMediaCallbackPtr;
532    uint32_t _timeStamp;
533    uint8_t _sendTelephoneEventPayloadType;
534
535    RemoteNtpTimeEstimator ntp_estimator_ GUARDED_BY(ts_stats_lock_);
536
537    // Timestamp of the audio pulled from NetEq.
538    uint32_t jitter_buffer_playout_timestamp_;
539    uint32_t playout_timestamp_rtp_ GUARDED_BY(video_sync_lock_);
540    uint32_t playout_timestamp_rtcp_;
541    uint32_t playout_delay_ms_ GUARDED_BY(video_sync_lock_);
542    uint32_t _numberOfDiscardedPackets;
543    uint16_t send_sequence_number_;
544    uint8_t restored_packet_[kVoiceEngineMaxIpPacketSizeBytes];
545
546    rtc::scoped_ptr<CriticalSectionWrapper> ts_stats_lock_;
547
548    rtc::scoped_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
549    // The rtp timestamp of the first played out audio frame.
550    int64_t capture_start_rtp_time_stamp_;
551    // The capture ntp time (in local timebase) of the first played out audio
552    // frame.
553    int64_t capture_start_ntp_time_ms_ GUARDED_BY(ts_stats_lock_);
554
555    // uses
556    Statistics* _engineStatisticsPtr;
557    OutputMixer* _outputMixerPtr;
558    TransmitMixer* _transmitMixerPtr;
559    ProcessThread* _moduleProcessThreadPtr;
560    AudioDeviceModule* _audioDeviceModulePtr;
561    VoiceEngineObserver* _voiceEngineObserverPtr; // owned by base
562    CriticalSectionWrapper* _callbackCritSectPtr; // owned by base
563    Transport* _transportPtr; // WebRtc socket or external transport
564    RMSLevel rms_level_;
565    rtc::scoped_ptr<AudioProcessing> rx_audioproc_;  // far end AudioProcessing
566    VoERxVadCallback* _rxVadObserverPtr;
567    int32_t _oldVadDecision;
568    int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise
569    // VoEBase
570    bool _externalMixing;
571    bool _mixFileWithMicrophone;
572    // VoEVolumeControl
573    bool _mute;
574    float _panLeft;
575    float _panRight;
576    float _outputGain;
577    // VoEDtmf
578    bool _playOutbandDtmfEvent;
579    bool _playInbandDtmfEvent;
580    // VoeRTP_RTCP
581    uint32_t _lastLocalTimeStamp;
582    int8_t _lastPayloadType;
583    bool _includeAudioLevelIndication;
584    // VoENetwork
585    AudioFrame::SpeechType _outputSpeechType;
586    // VoEVideoSync
587    rtc::scoped_ptr<CriticalSectionWrapper> video_sync_lock_;
588    uint32_t _average_jitter_buffer_delay_us GUARDED_BY(video_sync_lock_);
589    uint32_t _previousTimestamp;
590    uint16_t _recPacketDelayMs GUARDED_BY(video_sync_lock_);
591    // VoEAudioProcessing
592    bool _RxVadDetection;
593    bool _rxAgcIsEnabled;
594    bool _rxNsIsEnabled;
595    bool restored_packet_in_use_;
596    // RtcpBandwidthObserver
597    rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_;
598    rtc::scoped_ptr<NetworkPredictor> network_predictor_;
599    // An associated send channel.
600    rtc::scoped_ptr<CriticalSectionWrapper> assoc_send_channel_lock_;
601    ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_);
602
603    bool pacing_enabled_;
604    PacketRouter* packet_router_ = nullptr;
605    rtc::scoped_ptr<TransportFeedbackProxy> feedback_observer_proxy_;
606    rtc::scoped_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_;
607    rtc::scoped_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_;
608};
609
610}  // namespace voe
611}  // namespace webrtc
612
613#endif  // WEBRTC_VOICE_ENGINE_CHANNEL_H_
614