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