niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 0975d21 | 2012-03-06 20:59:13 +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 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 11 | #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
| 12 | #include "webrtc/system_wrappers/interface/file_wrapper.h" |
| 13 | #include "webrtc/system_wrappers/interface/trace.h" |
solenberg@webrtc.org | b1f5010 | 2014-03-24 10:38:25 +0000 | [diff] [blame] | 14 | #include "webrtc/video_engine/include/vie_network.h" |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 15 | #include "webrtc/voice_engine/include/voe_errors.h" |
| 16 | #include "webrtc/voice_engine/voe_rtp_rtcp_impl.h" |
| 17 | #include "webrtc/voice_engine/voice_engine_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 19 | #include "webrtc/voice_engine/channel.h" |
| 20 | #include "webrtc/voice_engine/transmit_mixer.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
| 24 | VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) |
| 25 | { |
| 26 | #ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 27 | return NULL; |
| 28 | #else |
| 29 | if (NULL == voiceEngine) |
| 30 | { |
| 31 | return NULL; |
| 32 | } |
tommi@webrtc.org | 0989fb7 | 2013-02-15 15:07:32 +0000 | [diff] [blame] | 33 | VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
tommi@webrtc.org | a990e12 | 2012-04-26 15:28:22 +0000 | [diff] [blame] | 34 | s->AddRef(); |
| 35 | return s; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | #endif |
| 37 | } |
| 38 | |
| 39 | #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 40 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 41 | VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 43 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor"); |
| 45 | } |
| 46 | |
| 47 | VoERTP_RTCPImpl::~VoERTP_RTCPImpl() |
| 48 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 49 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 50 | "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor"); |
| 51 | } |
| 52 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) |
| 54 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 55 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 56 | "SetLocalSSRC(channel=%d, %lu)", channel, ssrc); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 57 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 59 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 60 | return -1; |
| 61 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 62 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 63 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 64 | if (channelPtr == NULL) |
| 65 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 66 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | "SetLocalSSRC() failed to locate channel"); |
| 68 | return -1; |
| 69 | } |
| 70 | return channelPtr->SetLocalSSRC(ssrc); |
| 71 | } |
| 72 | |
| 73 | int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) |
| 74 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 75 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 76 | "GetLocalSSRC(channel=%d, ssrc=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 77 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 78 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 79 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 80 | return -1; |
| 81 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 82 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 83 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 84 | if (channelPtr == NULL) |
| 85 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 86 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 87 | "GetLocalSSRC() failed to locate channel"); |
| 88 | return -1; |
| 89 | } |
| 90 | return channelPtr->GetLocalSSRC(ssrc); |
| 91 | } |
| 92 | |
| 93 | int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) |
| 94 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 95 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 96 | "GetRemoteSSRC(channel=%d, ssrc=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 97 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 98 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 99 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 100 | return -1; |
| 101 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 102 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 103 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 104 | if (channelPtr == NULL) |
| 105 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 106 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | "GetRemoteSSRC() failed to locate channel"); |
| 108 | return -1; |
| 109 | } |
| 110 | return channelPtr->GetRemoteSSRC(ssrc); |
| 111 | } |
| 112 | |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 113 | int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel, |
| 114 | bool enable, |
| 115 | unsigned char id) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 116 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 117 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 118 | "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d," |
| 119 | " ID=%u)", channel, enable, id); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 120 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 122 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 123 | return -1; |
| 124 | } |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 125 | if (enable && (id < kVoiceEngineMinRtpExtensionId || |
| 126 | id > kVoiceEngineMaxRtpExtensionId)) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 127 | { |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 128 | // [RFC5285] The 4-bit id is the local identifier of this element in |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 129 | // the range 1-14 inclusive. |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 130 | _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 131 | "SetSendAudioLevelIndicationStatus() invalid ID parameter"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 132 | return -1; |
| 133 | } |
| 134 | |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 135 | // Set state and id for the specified channel. |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 136 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 137 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 138 | if (channelPtr == NULL) |
| 139 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 140 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 141 | "SetSendAudioLevelIndicationStatus() failed to locate channel"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 142 | return -1; |
| 143 | } |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 144 | return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 145 | } |
| 146 | |
wu@webrtc.org | 93fd25c | 2014-04-24 20:33:08 +0000 | [diff] [blame] | 147 | int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel, |
| 148 | bool enable, |
| 149 | unsigned char id) { |
| 150 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 151 | "SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)", |
| 152 | channel, enable, id); |
| 153 | if (!_shared->statistics().Initialized()) { |
| 154 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 155 | return -1; |
| 156 | } |
| 157 | if (enable && |
| 158 | (id < kVoiceEngineMinRtpExtensionId || |
| 159 | id > kVoiceEngineMaxRtpExtensionId)) { |
| 160 | // [RFC5285] The 4-bit id is the local identifier of this element in |
| 161 | // the range 1-14 inclusive. |
| 162 | _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
| 163 | "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter"); |
| 164 | return -1; |
| 165 | } |
| 166 | // Set state and id for the specified channel. |
| 167 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 168 | voe::Channel* channel_ptr = ch.channel(); |
| 169 | if (channel_ptr == NULL) { |
| 170 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 171 | "SetReceiveAudioLevelIndicationStatus() failed to locate channel"); |
| 172 | return -1; |
| 173 | } |
| 174 | return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id); |
| 175 | } |
| 176 | |
wu@webrtc.org | ebdb0e3 | 2014-03-06 23:49:08 +0000 | [diff] [blame] | 177 | int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel, |
| 178 | bool enable, |
| 179 | unsigned char id) { |
| 180 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 181 | "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)", |
| 182 | channel, enable, id); |
| 183 | if (!_shared->statistics().Initialized()) { |
| 184 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 185 | return -1; |
| 186 | } |
| 187 | if (enable && (id < kVoiceEngineMinRtpExtensionId || |
| 188 | id > kVoiceEngineMaxRtpExtensionId)) { |
| 189 | // [RFC5285] The 4-bit id is the local identifier of this element in |
| 190 | // the range 1-14 inclusive. |
| 191 | _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
| 192 | "SetSendAbsoluteSenderTimeStatus() invalid id parameter"); |
| 193 | return -1; |
| 194 | } |
| 195 | // Set state and id for the specified channel. |
| 196 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 197 | voe::Channel* channelPtr = ch.channel(); |
| 198 | if (channelPtr == NULL) { |
| 199 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 200 | "SetSendAbsoluteSenderTimeStatus() failed to locate channel"); |
| 201 | return -1; |
| 202 | } |
| 203 | return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id); |
| 204 | } |
| 205 | |
| 206 | int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel, |
| 207 | bool enable, |
| 208 | unsigned char id) { |
| 209 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 210 | "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)", |
| 211 | channel, enable, id); |
| 212 | if (!_shared->statistics().Initialized()) { |
| 213 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 214 | return -1; |
| 215 | } |
| 216 | if (enable && (id < kVoiceEngineMinRtpExtensionId || |
| 217 | id > kVoiceEngineMaxRtpExtensionId)) { |
| 218 | // [RFC5285] The 4-bit id is the local identifier of this element in |
| 219 | // the range 1-14 inclusive. |
| 220 | _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
| 221 | "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter"); |
| 222 | return -1; |
| 223 | } |
| 224 | // Set state and id for the specified channel. |
| 225 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 226 | voe::Channel* channelPtr = ch.channel(); |
| 227 | if (channelPtr == NULL) { |
| 228 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 229 | "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel"); |
| 230 | return -1; |
| 231 | } |
| 232 | return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) |
| 236 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 237 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 238 | "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 239 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 240 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 241 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 242 | return -1; |
| 243 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 244 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 245 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 246 | if (channelPtr == NULL) |
| 247 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 248 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 249 | "SetRTCPStatus() failed to locate channel"); |
| 250 | return -1; |
| 251 | } |
| 252 | return channelPtr->SetRTCPStatus(enable); |
| 253 | } |
| 254 | |
| 255 | int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) |
| 256 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 257 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 258 | "GetRTCPStatus(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 259 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 260 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 261 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 262 | return -1; |
| 263 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 264 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 265 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | if (channelPtr == NULL) |
| 267 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 268 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 269 | "GetRTCPStatus() failed to locate channel"); |
| 270 | return -1; |
| 271 | } |
| 272 | return channelPtr->GetRTCPStatus(enabled); |
| 273 | } |
| 274 | |
| 275 | int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) |
| 276 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 277 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 278 | "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 279 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 280 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 281 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | return -1; |
| 283 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 284 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 285 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 286 | if (channelPtr == NULL) |
| 287 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 288 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 289 | "SetRTCP_CNAME() failed to locate channel"); |
| 290 | return -1; |
| 291 | } |
| 292 | return channelPtr->SetRTCP_CNAME(cName); |
| 293 | } |
| 294 | |
| 295 | int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256]) |
| 296 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 297 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 298 | "GetRTCP_CNAME(channel=%d, cName=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 299 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 300 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 301 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 302 | return -1; |
| 303 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 304 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 305 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 306 | if (channelPtr == NULL) |
| 307 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 308 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 309 | "GetRTCP_CNAME() failed to locate channel"); |
| 310 | return -1; |
| 311 | } |
| 312 | return channelPtr->GetRTCP_CNAME(cName); |
| 313 | } |
| 314 | |
| 315 | int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) |
| 316 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 317 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 318 | "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 319 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 320 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 321 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 322 | return -1; |
| 323 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 324 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 325 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 326 | if (channelPtr == NULL) |
| 327 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 328 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 329 | "GetRemoteRTCP_CNAME() failed to locate channel"); |
| 330 | return -1; |
| 331 | } |
| 332 | return channelPtr->GetRemoteRTCP_CNAME(cName); |
| 333 | } |
| 334 | |
| 335 | int VoERTP_RTCPImpl::GetRemoteRTCPData( |
| 336 | int channel, |
| 337 | unsigned int& NTPHigh, // from sender info in SR |
| 338 | unsigned int& NTPLow, // from sender info in SR |
| 339 | unsigned int& timestamp, // from sender info in SR |
| 340 | unsigned int& playoutTimestamp, // derived locally |
| 341 | unsigned int* jitter, // from report block 1 in SR/RR |
| 342 | unsigned short* fractionLost) // from report block 1 in SR/RR |
| 343 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 344 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 345 | "GetRemoteRTCPData(channel=%d,...)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 346 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 347 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 348 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 349 | return -1; |
| 350 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 351 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 352 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 353 | if (channelPtr == NULL) |
| 354 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 355 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 356 | "GetRemoteRTCP_CNAME() failed to locate channel"); |
| 357 | return -1; |
| 358 | } |
| 359 | return channelPtr->GetRemoteRTCPData(NTPHigh, |
| 360 | NTPLow, |
| 361 | timestamp, |
| 362 | playoutTimestamp, |
| 363 | jitter, |
| 364 | fractionLost); |
| 365 | } |
| 366 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 367 | int VoERTP_RTCPImpl::GetRTPStatistics(int channel, |
| 368 | unsigned int& averageJitterMs, |
| 369 | unsigned int& maxJitterMs, |
| 370 | unsigned int& discardedPackets) |
| 371 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 372 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 373 | "GetRTPStatistics(channel=%d,....)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 374 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 375 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 376 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 377 | return -1; |
| 378 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 379 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 380 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 381 | if (channelPtr == NULL) |
| 382 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 383 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 384 | "GetRTPStatistics() failed to locate channel"); |
| 385 | return -1; |
| 386 | } |
| 387 | return channelPtr->GetRTPStatistics(averageJitterMs, |
| 388 | maxJitterMs, |
| 389 | discardedPackets); |
| 390 | } |
| 391 | |
| 392 | int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) |
| 393 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 394 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 395 | "GetRTCPStatistics(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 396 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 397 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 398 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 399 | return -1; |
| 400 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 401 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 402 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 403 | if (channelPtr == NULL) |
| 404 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 405 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 406 | "GetRTPStatistics() failed to locate channel"); |
| 407 | return -1; |
| 408 | } |
| 409 | return channelPtr->GetRTPStatistics(stats); |
| 410 | } |
| 411 | |
henrika@webrtc.org | 8a2fc88 | 2012-08-22 08:53:55 +0000 | [diff] [blame] | 412 | int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( |
| 413 | int channel, std::vector<ReportBlock>* report_blocks) { |
| 414 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 415 | "GetRemoteRTCPReportBlocks(channel=%d)", channel); |
| 416 | if (!_shared->statistics().Initialized()) { |
| 417 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 418 | return -1; |
| 419 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 420 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 421 | voe::Channel* channel_ptr = ch.channel(); |
henrika@webrtc.org | 8a2fc88 | 2012-08-22 08:53:55 +0000 | [diff] [blame] | 422 | if (channel_ptr == NULL) { |
| 423 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 424 | "GetRemoteRTCPReportBlocks() failed to locate channel"); |
| 425 | return -1; |
| 426 | } |
| 427 | return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); |
| 428 | } |
| 429 | |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 430 | int VoERTP_RTCPImpl::SetREDStatus(int channel, bool enable, int redPayloadtype) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 431 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 432 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 433 | "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 434 | channel, enable, redPayloadtype); |
| 435 | #ifdef WEBRTC_CODEC_RED |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 436 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 437 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 438 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 439 | return -1; |
| 440 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 441 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 442 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 443 | if (channelPtr == NULL) |
| 444 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 445 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 446 | "SetREDStatus() failed to locate channel"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 447 | return -1; |
| 448 | } |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 449 | return channelPtr->SetREDStatus(enable, redPayloadtype); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 450 | #else |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 451 | _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 452 | "SetREDStatus() RED is not supported"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 453 | return -1; |
| 454 | #endif |
| 455 | } |
| 456 | |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 457 | int VoERTP_RTCPImpl::GetREDStatus(int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 458 | bool& enabled, |
| 459 | int& redPayloadtype) |
| 460 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 461 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 462 | "GetREDStatus(channel=%d, enabled=?, redPayloadtype=?)", |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 463 | channel); |
| 464 | #ifdef WEBRTC_CODEC_RED |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 465 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 466 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 467 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 468 | return -1; |
| 469 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 470 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 471 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 472 | if (channelPtr == NULL) |
| 473 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 474 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 475 | "GetREDStatus() failed to locate channel"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 476 | return -1; |
| 477 | } |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 478 | return channelPtr->GetREDStatus(enabled, redPayloadtype); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 479 | #else |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 480 | _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
minyue@webrtc.org | c1a40a7 | 2014-05-28 09:52:06 +0000 | [diff] [blame] | 481 | "GetREDStatus() RED is not supported"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 482 | return -1; |
| 483 | #endif |
| 484 | } |
| 485 | |
niklas.enbom@webrtc.org | b35d2e3 | 2013-05-31 21:13:52 +0000 | [diff] [blame] | 486 | int VoERTP_RTCPImpl::SetNACKStatus(int channel, |
| 487 | bool enable, |
| 488 | int maxNoPackets) |
| 489 | { |
| 490 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 491 | "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", |
| 492 | channel, enable, maxNoPackets); |
pwestin@webrtc.org | db24995 | 2013-06-05 15:33:20 +0000 | [diff] [blame] | 493 | |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 494 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 495 | voe::Channel* channelPtr = ch.channel(); |
pwestin@webrtc.org | db24995 | 2013-06-05 15:33:20 +0000 | [diff] [blame] | 496 | if (channelPtr == NULL) |
| 497 | { |
| 498 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 499 | "SetNACKStatus() failed to locate channel"); |
| 500 | return -1; |
| 501 | } |
| 502 | channelPtr->SetNACKStatus(enable, maxNoPackets); |
niklas.enbom@webrtc.org | b35d2e3 | 2013-05-31 21:13:52 +0000 | [diff] [blame] | 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 507 | int VoERTP_RTCPImpl::StartRTPDump(int channel, |
| 508 | const char fileNameUTF8[1024], |
| 509 | RTPDirections direction) |
| 510 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 511 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 512 | "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)", |
| 513 | channel, fileNameUTF8, direction); |
| 514 | assert(1024 == FileWrapper::kMaxFileNameSize); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 515 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 516 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 517 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 518 | return -1; |
| 519 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 520 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 521 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 522 | if (channelPtr == NULL) |
| 523 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 524 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 525 | "StartRTPDump() failed to locate channel"); |
| 526 | return -1; |
| 527 | } |
| 528 | return channelPtr->StartRTPDump(fileNameUTF8, direction); |
| 529 | } |
| 530 | |
| 531 | int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction) |
| 532 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 533 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 534 | "StopRTPDump(channel=%d, direction=%d)", channel, direction); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 535 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 536 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 537 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 538 | return -1; |
| 539 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 540 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 541 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 542 | if (channelPtr == NULL) |
| 543 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 544 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 545 | "StopRTPDump() failed to locate channel"); |
| 546 | return -1; |
| 547 | } |
| 548 | return channelPtr->StopRTPDump(direction); |
| 549 | } |
| 550 | |
| 551 | int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction) |
| 552 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 553 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 554 | "RTPDumpIsActive(channel=%d, direction=%d)", |
| 555 | channel, direction); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 556 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 557 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 558 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 559 | return -1; |
| 560 | } |
pbos@webrtc.org | 676ff1e | 2013-08-07 17:57:36 +0000 | [diff] [blame] | 561 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 562 | voe::Channel* channelPtr = ch.channel(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 563 | if (channelPtr == NULL) |
| 564 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 565 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 566 | "StopRTPDump() failed to locate channel"); |
| 567 | return -1; |
| 568 | } |
| 569 | return channelPtr->RTPDumpIsActive(direction); |
| 570 | } |
| 571 | |
solenberg@webrtc.org | b1f5010 | 2014-03-24 10:38:25 +0000 | [diff] [blame] | 572 | int VoERTP_RTCPImpl::SetVideoEngineBWETarget(int channel, |
| 573 | ViENetwork* vie_network, |
| 574 | int video_channel) { |
| 575 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 576 | "SetVideoEngineBWETarget(channel=%d, vie_network=?, video_channel=%d)", |
| 577 | channel, vie_network, video_channel); |
| 578 | |
| 579 | voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
| 580 | voe::Channel* channelPtr = ch.channel(); |
| 581 | if (channelPtr == NULL) { |
| 582 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 583 | "SetVideoEngineBWETarget() failed to locate channel"); |
| 584 | if (vie_network) { |
| 585 | vie_network->Release(); |
| 586 | } |
| 587 | return -1; |
| 588 | } |
| 589 | channelPtr->SetVideoEngineBWETarget(vie_network, video_channel); |
| 590 | return 0; |
| 591 | } |
| 592 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 593 | #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 594 | |
| 595 | } // namespace webrtc |