blob: 1a0b6c24c387d68d66d53e1469cc4ee664277d68 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org0975d212012-03-06 20:59:13 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000011#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.com470e71d2011-07-07 08:21:25 +000017
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000018#include "webrtc/voice_engine/channel.h"
19#include "webrtc/voice_engine/transmit_mixer.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000020
21namespace webrtc {
22
23VoERTP_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.org0989fb72013-02-15 15:07:32 +000032 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
tommi@webrtc.orga990e122012-04-26 15:28:22 +000033 s->AddRef();
34 return s;
niklase@google.com470e71d2011-07-07 08:21:25 +000035#endif
36}
37
38#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
39
tommi@webrtc.org851becd2012-04-04 14:57:19 +000040VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared)
niklase@google.com470e71d2011-07-07 08:21:25 +000041{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000042 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000043 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor");
44}
45
46VoERTP_RTCPImpl::~VoERTP_RTCPImpl()
47{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000048 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000049 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
50}
51
niklase@google.com470e71d2011-07-07 08:21:25 +000052int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
53{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000054 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000055 "RegisterRTPObserver(channel=%d observer=0x%x)",
56 channel, &observer);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000057 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +000058 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000059 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +000060 return -1;
61 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +000062 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
63 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +000064 if (channelPtr == NULL)
65 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000066 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +000067 "RegisterRTPObserver() failed to locate channel");
68 return -1;
69 }
70 return channelPtr->RegisterRTPObserver(observer);
71}
72
73int VoERTP_RTCPImpl::DeRegisterRTPObserver(int channel)
74{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000075 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000076 "DeRegisterRTPObserver(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000077 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +000078 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000079 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +000080 return -1;
81 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +000082 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
83 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +000084 if (channelPtr == NULL)
85 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000086 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +000087 "DeRegisterRTPObserver() failed to locate channel");
88 return -1;
89 }
90 return channelPtr->DeRegisterRTPObserver();
91}
92
93int VoERTP_RTCPImpl::RegisterRTCPObserver(int channel, VoERTCPObserver& observer)
94{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000095 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000096 "RegisterRTCPObserver(channel=%d observer=0x%x)",
97 channel, &observer);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000098 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +000099 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000100 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000101 return -1;
102 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000103 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
104 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000105 if (channelPtr == NULL)
106 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000107 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000108 "RegisterRTPObserver() failed to locate channel");
109 return -1;
110 }
111 return channelPtr->RegisterRTCPObserver(observer);
112}
113
114int VoERTP_RTCPImpl::DeRegisterRTCPObserver(int channel)
115{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000116 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000117 "DeRegisterRTCPObserver(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000118 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000119 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000120 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000121 return -1;
122 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000123 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
124 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000125 if (channelPtr == NULL)
126 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000127 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000128 "DeRegisterRTCPObserver() failed to locate channel");
129 return -1;
130 }
131 return channelPtr->DeRegisterRTCPObserver();
132}
133
134int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc)
135{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000136 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000137 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000138 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000139 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000140 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000141 return -1;
142 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000143 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
144 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000145 if (channelPtr == NULL)
146 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000147 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000148 "SetLocalSSRC() failed to locate channel");
149 return -1;
150 }
151 return channelPtr->SetLocalSSRC(ssrc);
152}
153
154int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc)
155{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000156 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000157 "GetLocalSSRC(channel=%d, ssrc=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000158 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000159 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000160 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000161 return -1;
162 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000163 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
164 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000165 if (channelPtr == NULL)
166 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000167 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000168 "GetLocalSSRC() failed to locate channel");
169 return -1;
170 }
171 return channelPtr->GetLocalSSRC(ssrc);
172}
173
174int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc)
175{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000176 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000177 "GetRemoteSSRC(channel=%d, ssrc=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000178 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000179 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000180 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000181 return -1;
182 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000183 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
184 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000185 if (channelPtr == NULL)
186 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000187 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000188 "GetRemoteSSRC() failed to locate channel");
189 return -1;
190 }
191 return channelPtr->GetRemoteSSRC(ssrc);
192}
193
194int VoERTP_RTCPImpl::GetRemoteCSRCs(int channel, unsigned int arrCSRC[15])
195{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000196 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000197 "GetRemoteCSRCs(channel=%d, arrCSRC=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000198 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000199 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000200 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000201 return -1;
202 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000203 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
204 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000205 if (channelPtr == NULL)
206 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000207 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000208 "GetRemoteCSRCs() failed to locate channel");
209 return -1;
210 }
211 return channelPtr->GetRemoteCSRCs(arrCSRC);
212}
213
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000214int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
215 bool enable,
216 unsigned char id)
niklase@google.com470e71d2011-07-07 08:21:25 +0000217{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000218 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000219 "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d,"
220 " ID=%u)", channel, enable, id);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000221 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000222 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000223 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000224 return -1;
225 }
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000226 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
227 id > kVoiceEngineMaxRtpExtensionId))
niklase@google.com470e71d2011-07-07 08:21:25 +0000228 {
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000229 // [RFC5285] The 4-bit id is the local identifier of this element in
niklase@google.com470e71d2011-07-07 08:21:25 +0000230 // the range 1-14 inclusive.
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000231 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000232 "SetSendAudioLevelIndicationStatus() invalid ID parameter");
niklase@google.com470e71d2011-07-07 08:21:25 +0000233 return -1;
234 }
235
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000236 // Set state and id for the specified channel.
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000237 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
238 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000239 if (channelPtr == NULL)
240 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000241 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000242 "SetSendAudioLevelIndicationStatus() failed to locate channel");
niklase@google.com470e71d2011-07-07 08:21:25 +0000243 return -1;
244 }
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000245 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000246}
247
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000248int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel,
249 bool enable,
250 unsigned char id) {
251 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
252 "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
253 channel, enable, id);
254 if (!_shared->statistics().Initialized()) {
255 _shared->SetLastError(VE_NOT_INITED, kTraceError);
256 return -1;
257 }
258 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
259 id > kVoiceEngineMaxRtpExtensionId)) {
260 // [RFC5285] The 4-bit id is the local identifier of this element in
261 // the range 1-14 inclusive.
262 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
263 "SetSendAbsoluteSenderTimeStatus() invalid id parameter");
264 return -1;
265 }
266 // Set state and id for the specified channel.
267 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
268 voe::Channel* channelPtr = ch.channel();
269 if (channelPtr == NULL) {
270 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
271 "SetSendAbsoluteSenderTimeStatus() failed to locate channel");
272 return -1;
273 }
274 return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id);
275}
276
277int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel,
278 bool enable,
279 unsigned char id) {
280 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
281 "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
282 channel, enable, id);
283 if (!_shared->statistics().Initialized()) {
284 _shared->SetLastError(VE_NOT_INITED, kTraceError);
285 return -1;
286 }
287 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
288 id > kVoiceEngineMaxRtpExtensionId)) {
289 // [RFC5285] The 4-bit id is the local identifier of this element in
290 // the range 1-14 inclusive.
291 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
292 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
293 return -1;
294 }
295 // Set state and id for the specified channel.
296 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
297 voe::Channel* channelPtr = ch.channel();
298 if (channelPtr == NULL) {
299 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
300 "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel");
301 return -1;
302 }
303 return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000304}
305
306int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable)
307{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000308 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000309 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000310 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000311 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000312 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000313 return -1;
314 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000315 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
316 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000317 if (channelPtr == NULL)
318 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000319 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000320 "SetRTCPStatus() failed to locate channel");
321 return -1;
322 }
323 return channelPtr->SetRTCPStatus(enable);
324}
325
326int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled)
327{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000328 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000329 "GetRTCPStatus(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000330 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000331 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000332 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000333 return -1;
334 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000335 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
336 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000337 if (channelPtr == NULL)
338 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000339 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000340 "GetRTCPStatus() failed to locate channel");
341 return -1;
342 }
343 return channelPtr->GetRTCPStatus(enabled);
344}
345
346int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256])
347{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000348 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000349 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000350 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000351 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000352 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000353 return -1;
354 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000355 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
356 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000357 if (channelPtr == NULL)
358 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000359 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000360 "SetRTCP_CNAME() failed to locate channel");
361 return -1;
362 }
363 return channelPtr->SetRTCP_CNAME(cName);
364}
365
366int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256])
367{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000368 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000369 "GetRTCP_CNAME(channel=%d, cName=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000370 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000371 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000372 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000373 return -1;
374 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000375 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
376 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000377 if (channelPtr == NULL)
378 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000379 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000380 "GetRTCP_CNAME() failed to locate channel");
381 return -1;
382 }
383 return channelPtr->GetRTCP_CNAME(cName);
384}
385
386int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256])
387{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000388 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000389 "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000390 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000391 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000392 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000393 return -1;
394 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000395 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
396 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000397 if (channelPtr == NULL)
398 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000399 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000400 "GetRemoteRTCP_CNAME() failed to locate channel");
401 return -1;
402 }
403 return channelPtr->GetRemoteRTCP_CNAME(cName);
404}
405
406int VoERTP_RTCPImpl::GetRemoteRTCPData(
407 int channel,
408 unsigned int& NTPHigh, // from sender info in SR
409 unsigned int& NTPLow, // from sender info in SR
410 unsigned int& timestamp, // from sender info in SR
411 unsigned int& playoutTimestamp, // derived locally
412 unsigned int* jitter, // from report block 1 in SR/RR
413 unsigned short* fractionLost) // from report block 1 in SR/RR
414{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000415 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000416 "GetRemoteRTCPData(channel=%d,...)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000417 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000418 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000419 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000420 return -1;
421 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000422 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
423 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000424 if (channelPtr == NULL)
425 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000426 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000427 "GetRemoteRTCP_CNAME() failed to locate channel");
428 return -1;
429 }
430 return channelPtr->GetRemoteRTCPData(NTPHigh,
431 NTPLow,
432 timestamp,
433 playoutTimestamp,
434 jitter,
435 fractionLost);
436}
437
438int VoERTP_RTCPImpl::SendApplicationDefinedRTCPPacket(
439 int channel,
pbos@webrtc.org92135212013-05-14 08:31:39 +0000440 unsigned char subType,
niklase@google.com470e71d2011-07-07 08:21:25 +0000441 unsigned int name,
442 const char* data,
443 unsigned short dataLengthInBytes)
444{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000445 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000446 "SendApplicationDefinedRTCPPacket(channel=%d, subType=%u,"
447 "name=%u, data=?, dataLengthInBytes=%u)",
448 channel, subType, name, dataLengthInBytes);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000449 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000450 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000451 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000452 return -1;
453 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000454 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
455 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000456 if (channelPtr == NULL)
457 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000458 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000459 "SendApplicationDefinedRTCPPacket() failed to locate channel");
460 return -1;
461 }
462 return channelPtr->SendApplicationDefinedRTCPPacket(subType,
463 name,
464 data,
465 dataLengthInBytes);
466}
467
468int VoERTP_RTCPImpl::GetRTPStatistics(int channel,
469 unsigned int& averageJitterMs,
470 unsigned int& maxJitterMs,
471 unsigned int& discardedPackets)
472{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000473 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000474 "GetRTPStatistics(channel=%d,....)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000475 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000476 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000477 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000478 return -1;
479 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000480 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
481 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000482 if (channelPtr == NULL)
483 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000484 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000485 "GetRTPStatistics() failed to locate channel");
486 return -1;
487 }
488 return channelPtr->GetRTPStatistics(averageJitterMs,
489 maxJitterMs,
490 discardedPackets);
491}
492
493int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats)
494{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000495 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000496 "GetRTCPStatistics(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000497 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000498 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000499 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000500 return -1;
501 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000502 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
503 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000504 if (channelPtr == NULL)
505 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000506 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000507 "GetRTPStatistics() failed to locate channel");
508 return -1;
509 }
510 return channelPtr->GetRTPStatistics(stats);
511}
512
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000513int VoERTP_RTCPImpl::GetRemoteRTCPSenderInfo(int channel,
514 SenderInfo* sender_info) {
515 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
516 "GetRemoteRTCPSenderInfo(channel=%d)", channel);
517 if (!_shared->statistics().Initialized()) {
518 _shared->SetLastError(VE_NOT_INITED, kTraceError);
519 return -1;
520 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000521 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
522 voe::Channel* channel_ptr = ch.channel();
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000523 if (channel_ptr == NULL) {
524 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
525 "GetRemoteRTCPSenderInfo() failed to locate channel");
526 return -1;
527 }
528 return channel_ptr->GetRemoteRTCPSenderInfo(sender_info);
529}
530
531int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
532 int channel, std::vector<ReportBlock>* report_blocks) {
533 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
534 "GetRemoteRTCPReportBlocks(channel=%d)", channel);
535 if (!_shared->statistics().Initialized()) {
536 _shared->SetLastError(VE_NOT_INITED, kTraceError);
537 return -1;
538 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000539 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
540 voe::Channel* channel_ptr = ch.channel();
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000541 if (channel_ptr == NULL) {
542 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
543 "GetRemoteRTCPReportBlocks() failed to locate channel");
544 return -1;
545 }
546 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks);
547}
548
niklase@google.com470e71d2011-07-07 08:21:25 +0000549int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype)
550{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000551 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000552 "SetFECStatus(channel=%d, enable=%d, redPayloadtype=%d)",
553 channel, enable, redPayloadtype);
554#ifdef WEBRTC_CODEC_RED
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000555 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000556 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000557 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000558 return -1;
559 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000560 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
561 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000562 if (channelPtr == NULL)
563 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000564 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000565 "SetFECStatus() failed to locate channel");
566 return -1;
567 }
568 return channelPtr->SetFECStatus(enable, redPayloadtype);
569#else
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000570 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
571 "SetFECStatus() RED is not supported");
niklase@google.com470e71d2011-07-07 08:21:25 +0000572 return -1;
573#endif
574}
575
576int VoERTP_RTCPImpl::GetFECStatus(int channel,
577 bool& enabled,
578 int& redPayloadtype)
579{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000580 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000581 "GetFECStatus(channel=%d, enabled=?, redPayloadtype=?)",
582 channel);
583#ifdef WEBRTC_CODEC_RED
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000584 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000585 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000586 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000587 return -1;
588 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000589 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
590 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000591 if (channelPtr == NULL)
592 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000593 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000594 "GetFECStatus() failed to locate channel");
595 return -1;
596 }
597 return channelPtr->GetFECStatus(enabled, redPayloadtype);
598#else
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000599 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
600 "GetFECStatus() RED is not supported");
niklase@google.com470e71d2011-07-07 08:21:25 +0000601 return -1;
602#endif
603}
604
niklas.enbom@webrtc.orgb35d2e32013-05-31 21:13:52 +0000605
606int VoERTP_RTCPImpl::SetNACKStatus(int channel,
607 bool enable,
608 int maxNoPackets)
609{
610 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
611 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)",
612 channel, enable, maxNoPackets);
pwestin@webrtc.orgdb249952013-06-05 15:33:20 +0000613
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000614 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
615 voe::Channel* channelPtr = ch.channel();
pwestin@webrtc.orgdb249952013-06-05 15:33:20 +0000616 if (channelPtr == NULL)
617 {
618 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
619 "SetNACKStatus() failed to locate channel");
620 return -1;
621 }
622 channelPtr->SetNACKStatus(enable, maxNoPackets);
niklas.enbom@webrtc.orgb35d2e32013-05-31 21:13:52 +0000623 return 0;
624}
625
626
niklase@google.com470e71d2011-07-07 08:21:25 +0000627int VoERTP_RTCPImpl::StartRTPDump(int channel,
628 const char fileNameUTF8[1024],
629 RTPDirections direction)
630{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000631 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000632 "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)",
633 channel, fileNameUTF8, direction);
634 assert(1024 == FileWrapper::kMaxFileNameSize);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000635 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000636 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000637 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000638 return -1;
639 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000640 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
641 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000642 if (channelPtr == NULL)
643 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000644 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000645 "StartRTPDump() failed to locate channel");
646 return -1;
647 }
648 return channelPtr->StartRTPDump(fileNameUTF8, direction);
649}
650
651int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction)
652{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000653 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000654 "StopRTPDump(channel=%d, direction=%d)", channel, direction);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000655 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000656 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000657 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000658 return -1;
659 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000660 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
661 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000662 if (channelPtr == NULL)
663 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000664 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000665 "StopRTPDump() failed to locate channel");
666 return -1;
667 }
668 return channelPtr->StopRTPDump(direction);
669}
670
671int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction)
672{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000673 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000674 "RTPDumpIsActive(channel=%d, direction=%d)",
675 channel, direction);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000676 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000677 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000678 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000679 return -1;
680 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000681 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
682 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000683 if (channelPtr == NULL)
684 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000685 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000686 "StopRTPDump() failed to locate channel");
687 return -1;
688 }
689 return channelPtr->RTPDumpIsActive(direction);
690}
691
roosa@google.com0870f022012-12-12 21:31:41 +0000692int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel,
693 uint32_t* timestamp) {
694 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
695 "GetLastRemoteTimeStamp(channel=%d, timestamp=?)", channel);
696 if (!_shared->statistics().Initialized())
697 {
698 _shared->SetLastError(VE_NOT_INITED, kTraceError);
699 return -1;
700 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000701 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
702 voe::Channel* channelPtr = ch.channel();
roosa@google.com0870f022012-12-12 21:31:41 +0000703 if (channelPtr == NULL)
704 {
705 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
706 "GetLastRemoteTimeStamp() failed to locate channel");
707 return -1;
708 }
709 *timestamp = channelPtr->LastRemoteTimeStamp();
710 return 0;
711}
712
niklase@google.com470e71d2011-07-07 08:21:25 +0000713#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
714
715} // namespace webrtc