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" |
| 14 | #include "webrtc/voice_engine/include/voe_errors.h" |
| 15 | #include "webrtc/voice_engine/voe_rtp_rtcp_impl.h" |
| 16 | #include "webrtc/voice_engine/voice_engine_impl.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame] | 18 | #include "webrtc/voice_engine/channel.h" |
| 19 | #include "webrtc/voice_engine/transmit_mixer.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) |
| 24 | { |
| 25 | #ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 26 | return NULL; |
| 27 | #else |
| 28 | if (NULL == voiceEngine) |
| 29 | { |
| 30 | return NULL; |
| 31 | } |
tommi@webrtc.org | 0989fb7 | 2013-02-15 15:07:32 +0000 | [diff] [blame] | 32 | VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
tommi@webrtc.org | a990e12 | 2012-04-26 15:28:22 +0000 | [diff] [blame] | 33 | s->AddRef(); |
| 34 | return s; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | #endif |
| 36 | } |
| 37 | |
| 38 | #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 39 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 40 | VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 42 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor"); |
| 44 | } |
| 45 | |
| 46 | VoERTP_RTCPImpl::~VoERTP_RTCPImpl() |
| 47 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 48 | WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 49 | "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor"); |
| 50 | } |
| 51 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer) |
| 53 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 54 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | "RegisterRTPObserver(channel=%d observer=0x%x)", |
| 56 | channel, &observer); |
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 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 62 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 63 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 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 | "RegisterRTPObserver() failed to locate channel"); |
| 68 | return -1; |
| 69 | } |
| 70 | return channelPtr->RegisterRTPObserver(observer); |
| 71 | } |
| 72 | |
| 73 | int VoERTP_RTCPImpl::DeRegisterRTPObserver(int channel) |
| 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 | "DeRegisterRTPObserver(channel=%d)", 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 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 82 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 83 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 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 | "DeRegisterRTPObserver() failed to locate channel"); |
| 88 | return -1; |
| 89 | } |
| 90 | return channelPtr->DeRegisterRTPObserver(); |
| 91 | } |
| 92 | |
| 93 | int VoERTP_RTCPImpl::RegisterRTCPObserver(int channel, VoERTCPObserver& observer) |
| 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 | "RegisterRTCPObserver(channel=%d observer=0x%x)", |
| 97 | channel, &observer); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 98 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 99 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 100 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 101 | return -1; |
| 102 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 103 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 104 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 105 | if (channelPtr == NULL) |
| 106 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 107 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 108 | "RegisterRTPObserver() failed to locate channel"); |
| 109 | return -1; |
| 110 | } |
| 111 | return channelPtr->RegisterRTCPObserver(observer); |
| 112 | } |
| 113 | |
| 114 | int VoERTP_RTCPImpl::DeRegisterRTCPObserver(int channel) |
| 115 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 116 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 117 | "DeRegisterRTCPObserver(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 118 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 119 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 120 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 121 | return -1; |
| 122 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 123 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 124 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 125 | if (channelPtr == NULL) |
| 126 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 127 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 128 | "DeRegisterRTCPObserver() failed to locate channel"); |
| 129 | return -1; |
| 130 | } |
| 131 | return channelPtr->DeRegisterRTCPObserver(); |
| 132 | } |
| 133 | |
| 134 | int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) |
| 135 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 136 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 137 | "SetLocalSSRC(channel=%d, %lu)", channel, ssrc); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 138 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 139 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 140 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 141 | return -1; |
| 142 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 143 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 144 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 145 | if (channelPtr == NULL) |
| 146 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 147 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 148 | "SetLocalSSRC() failed to locate channel"); |
| 149 | return -1; |
| 150 | } |
| 151 | return channelPtr->SetLocalSSRC(ssrc); |
| 152 | } |
| 153 | |
| 154 | int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) |
| 155 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 156 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 157 | "GetLocalSSRC(channel=%d, ssrc=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 158 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 159 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 160 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 161 | return -1; |
| 162 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 163 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 164 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 165 | if (channelPtr == NULL) |
| 166 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 167 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 168 | "GetLocalSSRC() failed to locate channel"); |
| 169 | return -1; |
| 170 | } |
| 171 | return channelPtr->GetLocalSSRC(ssrc); |
| 172 | } |
| 173 | |
| 174 | int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) |
| 175 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 176 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 177 | "GetRemoteSSRC(channel=%d, ssrc=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 178 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 179 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 180 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 181 | return -1; |
| 182 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 183 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 184 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 185 | if (channelPtr == NULL) |
| 186 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 187 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 188 | "GetRemoteSSRC() failed to locate channel"); |
| 189 | return -1; |
| 190 | } |
| 191 | return channelPtr->GetRemoteSSRC(ssrc); |
| 192 | } |
| 193 | |
| 194 | int VoERTP_RTCPImpl::GetRemoteCSRCs(int channel, unsigned int arrCSRC[15]) |
| 195 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 196 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 197 | "GetRemoteCSRCs(channel=%d, arrCSRC=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 198 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 199 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 200 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 201 | return -1; |
| 202 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 203 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 204 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 205 | if (channelPtr == NULL) |
| 206 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 207 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 208 | "GetRemoteCSRCs() failed to locate channel"); |
| 209 | return -1; |
| 210 | } |
| 211 | return channelPtr->GetRemoteCSRCs(arrCSRC); |
| 212 | } |
| 213 | |
| 214 | |
| 215 | int VoERTP_RTCPImpl::SetRTPAudioLevelIndicationStatus(int channel, |
| 216 | bool enable, |
| 217 | unsigned char ID) |
| 218 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 219 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 220 | "SetRTPAudioLevelIndicationStatus(channel=%d, enable=%d," |
| 221 | " ID=%u)", channel, enable, ID); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 222 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 223 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 224 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 225 | return -1; |
| 226 | } |
| 227 | if (ID < kVoiceEngineMinRtpExtensionId || |
| 228 | ID > kVoiceEngineMaxRtpExtensionId) |
| 229 | { |
| 230 | // [RFC5285] The 4-bit ID is the local identifier of this element in |
| 231 | // the range 1-14 inclusive. |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 232 | _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 233 | "SetRTPAudioLevelIndicationStatus() invalid ID parameter"); |
| 234 | return -1; |
| 235 | } |
| 236 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 237 | // Set state and ID for the specified channel. |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 238 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 239 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 240 | if (channelPtr == NULL) |
| 241 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 242 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 243 | "SetRTPAudioLevelIndicationStatus() failed to locate channel"); |
| 244 | return -1; |
| 245 | } |
| 246 | return channelPtr->SetRTPAudioLevelIndicationStatus(enable, ID); |
| 247 | } |
| 248 | |
| 249 | int VoERTP_RTCPImpl::GetRTPAudioLevelIndicationStatus(int channel, |
| 250 | bool& enabled, |
| 251 | unsigned char& ID) |
| 252 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 253 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 254 | "GetRTPAudioLevelIndicationStatus(channel=%d, enable=?, ID=?)", |
| 255 | channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 256 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 257 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 258 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 259 | return -1; |
| 260 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 261 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 262 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 263 | if (channelPtr == NULL) |
| 264 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 265 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 266 | "GetRTPAudioLevelIndicationStatus() failed to locate channel"); |
| 267 | return -1; |
| 268 | } |
| 269 | return channelPtr->GetRTPAudioLevelIndicationStatus(enabled, ID); |
| 270 | } |
| 271 | |
| 272 | int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) |
| 273 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 274 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 275 | "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 276 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 277 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 278 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 279 | return -1; |
| 280 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 281 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 282 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 283 | if (channelPtr == NULL) |
| 284 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 285 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 286 | "SetRTCPStatus() failed to locate channel"); |
| 287 | return -1; |
| 288 | } |
| 289 | return channelPtr->SetRTCPStatus(enable); |
| 290 | } |
| 291 | |
| 292 | int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) |
| 293 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 294 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 295 | "GetRTCPStatus(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 296 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 297 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 298 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 299 | return -1; |
| 300 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 301 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 302 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 303 | if (channelPtr == NULL) |
| 304 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 305 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 306 | "GetRTCPStatus() failed to locate channel"); |
| 307 | return -1; |
| 308 | } |
| 309 | return channelPtr->GetRTCPStatus(enabled); |
| 310 | } |
| 311 | |
| 312 | int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) |
| 313 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 314 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 315 | "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 316 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 317 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 318 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 319 | return -1; |
| 320 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 321 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 322 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 323 | if (channelPtr == NULL) |
| 324 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 325 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 326 | "SetRTCP_CNAME() failed to locate channel"); |
| 327 | return -1; |
| 328 | } |
| 329 | return channelPtr->SetRTCP_CNAME(cName); |
| 330 | } |
| 331 | |
| 332 | int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256]) |
| 333 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 334 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 335 | "GetRTCP_CNAME(channel=%d, cName=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 336 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 337 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 338 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 339 | return -1; |
| 340 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 341 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 342 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 343 | if (channelPtr == NULL) |
| 344 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 345 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 346 | "GetRTCP_CNAME() failed to locate channel"); |
| 347 | return -1; |
| 348 | } |
| 349 | return channelPtr->GetRTCP_CNAME(cName); |
| 350 | } |
| 351 | |
| 352 | int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) |
| 353 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 354 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 355 | "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 356 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 357 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 358 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 359 | return -1; |
| 360 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 361 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 362 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 363 | if (channelPtr == NULL) |
| 364 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 365 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 366 | "GetRemoteRTCP_CNAME() failed to locate channel"); |
| 367 | return -1; |
| 368 | } |
| 369 | return channelPtr->GetRemoteRTCP_CNAME(cName); |
| 370 | } |
| 371 | |
| 372 | int VoERTP_RTCPImpl::GetRemoteRTCPData( |
| 373 | int channel, |
| 374 | unsigned int& NTPHigh, // from sender info in SR |
| 375 | unsigned int& NTPLow, // from sender info in SR |
| 376 | unsigned int& timestamp, // from sender info in SR |
| 377 | unsigned int& playoutTimestamp, // derived locally |
| 378 | unsigned int* jitter, // from report block 1 in SR/RR |
| 379 | unsigned short* fractionLost) // from report block 1 in SR/RR |
| 380 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 381 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 382 | "GetRemoteRTCPData(channel=%d,...)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 383 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 384 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 385 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 386 | return -1; |
| 387 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 388 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 389 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 390 | if (channelPtr == NULL) |
| 391 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 392 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 393 | "GetRemoteRTCP_CNAME() failed to locate channel"); |
| 394 | return -1; |
| 395 | } |
| 396 | return channelPtr->GetRemoteRTCPData(NTPHigh, |
| 397 | NTPLow, |
| 398 | timestamp, |
| 399 | playoutTimestamp, |
| 400 | jitter, |
| 401 | fractionLost); |
| 402 | } |
| 403 | |
| 404 | int VoERTP_RTCPImpl::SendApplicationDefinedRTCPPacket( |
| 405 | int channel, |
pbos@webrtc.org | 9213521 | 2013-05-14 08:31:39 +0000 | [diff] [blame] | 406 | unsigned char subType, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 407 | unsigned int name, |
| 408 | const char* data, |
| 409 | unsigned short dataLengthInBytes) |
| 410 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 411 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 412 | "SendApplicationDefinedRTCPPacket(channel=%d, subType=%u," |
| 413 | "name=%u, data=?, dataLengthInBytes=%u)", |
| 414 | channel, subType, name, dataLengthInBytes); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 415 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 416 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 417 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 418 | return -1; |
| 419 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 420 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 421 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 422 | if (channelPtr == NULL) |
| 423 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 424 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 425 | "SendApplicationDefinedRTCPPacket() failed to locate channel"); |
| 426 | return -1; |
| 427 | } |
| 428 | return channelPtr->SendApplicationDefinedRTCPPacket(subType, |
| 429 | name, |
| 430 | data, |
| 431 | dataLengthInBytes); |
| 432 | } |
| 433 | |
| 434 | int VoERTP_RTCPImpl::GetRTPStatistics(int channel, |
| 435 | unsigned int& averageJitterMs, |
| 436 | unsigned int& maxJitterMs, |
| 437 | unsigned int& discardedPackets) |
| 438 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 439 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 440 | "GetRTPStatistics(channel=%d,....)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 441 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 442 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 443 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 444 | return -1; |
| 445 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 446 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 447 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 448 | if (channelPtr == NULL) |
| 449 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 450 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 451 | "GetRTPStatistics() failed to locate channel"); |
| 452 | return -1; |
| 453 | } |
| 454 | return channelPtr->GetRTPStatistics(averageJitterMs, |
| 455 | maxJitterMs, |
| 456 | discardedPackets); |
| 457 | } |
| 458 | |
| 459 | int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) |
| 460 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 461 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 462 | "GetRTCPStatistics(channel=%d)", channel); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 463 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 464 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 465 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 466 | return -1; |
| 467 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 468 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 469 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 470 | if (channelPtr == NULL) |
| 471 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 472 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 473 | "GetRTPStatistics() failed to locate channel"); |
| 474 | return -1; |
| 475 | } |
| 476 | return channelPtr->GetRTPStatistics(stats); |
| 477 | } |
| 478 | |
henrika@webrtc.org | 8a2fc88 | 2012-08-22 08:53:55 +0000 | [diff] [blame] | 479 | int VoERTP_RTCPImpl::GetRemoteRTCPSenderInfo(int channel, |
| 480 | SenderInfo* sender_info) { |
| 481 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 482 | "GetRemoteRTCPSenderInfo(channel=%d)", channel); |
| 483 | if (!_shared->statistics().Initialized()) { |
| 484 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 485 | return -1; |
| 486 | } |
| 487 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
| 488 | voe::Channel* channel_ptr = sc.ChannelPtr(); |
| 489 | if (channel_ptr == NULL) { |
| 490 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 491 | "GetRemoteRTCPSenderInfo() failed to locate channel"); |
| 492 | return -1; |
| 493 | } |
| 494 | return channel_ptr->GetRemoteRTCPSenderInfo(sender_info); |
| 495 | } |
| 496 | |
| 497 | int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( |
| 498 | int channel, std::vector<ReportBlock>* report_blocks) { |
| 499 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 500 | "GetRemoteRTCPReportBlocks(channel=%d)", channel); |
| 501 | if (!_shared->statistics().Initialized()) { |
| 502 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 503 | return -1; |
| 504 | } |
| 505 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
| 506 | voe::Channel* channel_ptr = sc.ChannelPtr(); |
| 507 | if (channel_ptr == NULL) { |
| 508 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 509 | "GetRemoteRTCPReportBlocks() failed to locate channel"); |
| 510 | return -1; |
| 511 | } |
| 512 | return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); |
| 513 | } |
| 514 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 515 | int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype) |
| 516 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 517 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 518 | "SetFECStatus(channel=%d, enable=%d, redPayloadtype=%d)", |
| 519 | channel, enable, redPayloadtype); |
| 520 | #ifdef WEBRTC_CODEC_RED |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 521 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 522 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 523 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 524 | return -1; |
| 525 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 526 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 527 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 528 | if (channelPtr == NULL) |
| 529 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 530 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 531 | "SetFECStatus() failed to locate channel"); |
| 532 | return -1; |
| 533 | } |
| 534 | return channelPtr->SetFECStatus(enable, redPayloadtype); |
| 535 | #else |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 536 | _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
| 537 | "SetFECStatus() RED is not supported"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 538 | return -1; |
| 539 | #endif |
| 540 | } |
| 541 | |
| 542 | int VoERTP_RTCPImpl::GetFECStatus(int channel, |
| 543 | bool& enabled, |
| 544 | int& redPayloadtype) |
| 545 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 546 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 547 | "GetFECStatus(channel=%d, enabled=?, redPayloadtype=?)", |
| 548 | channel); |
| 549 | #ifdef WEBRTC_CODEC_RED |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 550 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 551 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 552 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 553 | return -1; |
| 554 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 555 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 556 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 557 | if (channelPtr == NULL) |
| 558 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 559 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 560 | "GetFECStatus() failed to locate channel"); |
| 561 | return -1; |
| 562 | } |
| 563 | return channelPtr->GetFECStatus(enabled, redPayloadtype); |
| 564 | #else |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 565 | _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, |
| 566 | "GetFECStatus() RED is not supported"); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 567 | return -1; |
| 568 | #endif |
| 569 | } |
| 570 | |
niklas.enbom@webrtc.org | b35d2e3 | 2013-05-31 21:13:52 +0000 | [diff] [blame^] | 571 | |
| 572 | int VoERTP_RTCPImpl::SetNACKStatus(int channel, |
| 573 | bool enable, |
| 574 | int maxNoPackets) |
| 575 | { |
| 576 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 577 | "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", |
| 578 | channel, enable, maxNoPackets); |
| 579 | // Dummy for now |
| 580 | return 0; |
| 581 | } |
| 582 | |
| 583 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 584 | int VoERTP_RTCPImpl::StartRTPDump(int channel, |
| 585 | const char fileNameUTF8[1024], |
| 586 | RTPDirections direction) |
| 587 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 588 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 589 | "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)", |
| 590 | channel, fileNameUTF8, direction); |
| 591 | assert(1024 == FileWrapper::kMaxFileNameSize); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 592 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 593 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 594 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 595 | return -1; |
| 596 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 597 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 598 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 599 | if (channelPtr == NULL) |
| 600 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 601 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 602 | "StartRTPDump() failed to locate channel"); |
| 603 | return -1; |
| 604 | } |
| 605 | return channelPtr->StartRTPDump(fileNameUTF8, direction); |
| 606 | } |
| 607 | |
| 608 | int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction) |
| 609 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 610 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 611 | "StopRTPDump(channel=%d, direction=%d)", channel, direction); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 612 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 613 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 614 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 615 | return -1; |
| 616 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 617 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 618 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 619 | if (channelPtr == NULL) |
| 620 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 621 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 622 | "StopRTPDump() failed to locate channel"); |
| 623 | return -1; |
| 624 | } |
| 625 | return channelPtr->StopRTPDump(direction); |
| 626 | } |
| 627 | |
| 628 | int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction) |
| 629 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 630 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 631 | "RTPDumpIsActive(channel=%d, direction=%d)", |
| 632 | channel, direction); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 633 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 634 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 635 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 636 | return -1; |
| 637 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 638 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 639 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 640 | if (channelPtr == NULL) |
| 641 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 642 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 643 | "StopRTPDump() failed to locate channel"); |
| 644 | return -1; |
| 645 | } |
| 646 | return channelPtr->RTPDumpIsActive(direction); |
| 647 | } |
| 648 | |
| 649 | int VoERTP_RTCPImpl::InsertExtraRTPPacket(int channel, |
| 650 | unsigned char payloadType, |
| 651 | bool markerBit, |
| 652 | const char* payloadData, |
| 653 | unsigned short payloadSize) |
| 654 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 655 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 656 | "InsertExtraRTPPacket(channel=%d, payloadType=%u," |
| 657 | " markerBit=%u, payloadSize=%u)", |
| 658 | channel, payloadType, markerBit, payloadSize); |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 659 | if (!_shared->statistics().Initialized()) |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 660 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 661 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 662 | return -1; |
| 663 | } |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 664 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 665 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 666 | if (channelPtr == NULL) |
| 667 | { |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 668 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 669 | "StopRTPDump() failed to locate channel"); |
| 670 | return -1; |
| 671 | } |
| 672 | return channelPtr->InsertExtraRTPPacket(payloadType, |
| 673 | markerBit, |
| 674 | payloadData, |
| 675 | payloadSize); |
| 676 | } |
| 677 | |
roosa@google.com | 0870f02 | 2012-12-12 21:31:41 +0000 | [diff] [blame] | 678 | int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel, |
| 679 | uint32_t* timestamp) { |
| 680 | WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
| 681 | "GetLastRemoteTimeStamp(channel=%d, timestamp=?)", channel); |
| 682 | if (!_shared->statistics().Initialized()) |
| 683 | { |
| 684 | _shared->SetLastError(VE_NOT_INITED, kTraceError); |
| 685 | return -1; |
| 686 | } |
| 687 | voe::ScopedChannel sc(_shared->channel_manager(), channel); |
| 688 | voe::Channel* channelPtr = sc.ChannelPtr(); |
| 689 | if (channelPtr == NULL) |
| 690 | { |
| 691 | _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
| 692 | "GetLastRemoteTimeStamp() failed to locate channel"); |
| 693 | return -1; |
| 694 | } |
| 695 | *timestamp = channelPtr->LastRemoteTimeStamp(); |
| 696 | return 0; |
| 697 | } |
| 698 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 699 | #endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API |
| 700 | |
| 701 | } // namespace webrtc |