blob: e20695af1b1e0a28a68d8a627845fcf023be8bd0 [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"
solenberg@webrtc.orgb1f50102014-03-24 10:38:25 +000014#include "webrtc/video_engine/include/vie_network.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000015#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.com470e71d2011-07-07 08:21:25 +000018
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000019#include "webrtc/voice_engine/channel.h"
20#include "webrtc/voice_engine/transmit_mixer.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
22namespace webrtc {
23
24VoERTP_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.org0989fb72013-02-15 15:07:32 +000033 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
tommi@webrtc.orga990e122012-04-26 15:28:22 +000034 s->AddRef();
35 return s;
niklase@google.com470e71d2011-07-07 08:21:25 +000036#endif
37}
38
39#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
40
tommi@webrtc.org851becd2012-04-04 14:57:19 +000041VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared)
niklase@google.com470e71d2011-07-07 08:21:25 +000042{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000043 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000044 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor");
45}
46
47VoERTP_RTCPImpl::~VoERTP_RTCPImpl()
48{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000049 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000050 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
51}
52
niklase@google.com470e71d2011-07-07 08:21:25 +000053int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
54{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000055 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000056 "RegisterRTPObserver(channel=%d observer=0x%x)",
57 channel, &observer);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000058 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +000059 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000060 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +000061 return -1;
62 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +000063 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
64 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +000065 if (channelPtr == NULL)
66 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000067 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +000068 "RegisterRTPObserver() failed to locate channel");
69 return -1;
70 }
71 return channelPtr->RegisterRTPObserver(observer);
72}
73
74int VoERTP_RTCPImpl::DeRegisterRTPObserver(int channel)
75{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000076 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000077 "DeRegisterRTPObserver(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000078 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +000079 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000080 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +000081 return -1;
82 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +000083 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
84 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +000085 if (channelPtr == NULL)
86 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +000087 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +000088 "DeRegisterRTPObserver() failed to locate channel");
89 return -1;
90 }
91 return channelPtr->DeRegisterRTPObserver();
92}
93
94int VoERTP_RTCPImpl::RegisterRTCPObserver(int channel, VoERTCPObserver& observer)
95{
tommi@webrtc.org851becd2012-04-04 14:57:19 +000096 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +000097 "RegisterRTCPObserver(channel=%d observer=0x%x)",
98 channel, &observer);
tommi@webrtc.org851becd2012-04-04 14:57:19 +000099 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000100 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000101 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000102 return -1;
103 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000104 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
105 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000106 if (channelPtr == NULL)
107 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000108 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000109 "RegisterRTPObserver() failed to locate channel");
110 return -1;
111 }
112 return channelPtr->RegisterRTCPObserver(observer);
113}
114
115int VoERTP_RTCPImpl::DeRegisterRTCPObserver(int channel)
116{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000117 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000118 "DeRegisterRTCPObserver(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000119 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000120 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000121 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000122 return -1;
123 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000124 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
125 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000126 if (channelPtr == NULL)
127 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000128 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000129 "DeRegisterRTCPObserver() failed to locate channel");
130 return -1;
131 }
132 return channelPtr->DeRegisterRTCPObserver();
133}
134
135int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc)
136{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000137 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000138 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000139 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000140 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000141 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000142 return -1;
143 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000144 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
145 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000146 if (channelPtr == NULL)
147 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000148 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000149 "SetLocalSSRC() failed to locate channel");
150 return -1;
151 }
152 return channelPtr->SetLocalSSRC(ssrc);
153}
154
155int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc)
156{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000157 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000158 "GetLocalSSRC(channel=%d, ssrc=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000159 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000160 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000161 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000162 return -1;
163 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000164 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
165 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000166 if (channelPtr == NULL)
167 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000168 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000169 "GetLocalSSRC() failed to locate channel");
170 return -1;
171 }
172 return channelPtr->GetLocalSSRC(ssrc);
173}
174
175int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc)
176{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000177 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000178 "GetRemoteSSRC(channel=%d, ssrc=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000179 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000180 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000181 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000182 return -1;
183 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000184 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
185 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000186 if (channelPtr == NULL)
187 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000188 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000189 "GetRemoteSSRC() failed to locate channel");
190 return -1;
191 }
192 return channelPtr->GetRemoteSSRC(ssrc);
193}
194
195int VoERTP_RTCPImpl::GetRemoteCSRCs(int channel, unsigned int arrCSRC[15])
196{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000197 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000198 "GetRemoteCSRCs(channel=%d, arrCSRC=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000199 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000200 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000201 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000202 return -1;
203 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000204 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
205 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000206 if (channelPtr == NULL)
207 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000208 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000209 "GetRemoteCSRCs() failed to locate channel");
210 return -1;
211 }
212 return channelPtr->GetRemoteCSRCs(arrCSRC);
213}
214
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000215int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
216 bool enable,
217 unsigned char id)
niklase@google.com470e71d2011-07-07 08:21:25 +0000218{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000219 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000220 "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d,"
221 " ID=%u)", channel, enable, id);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000222 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000223 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000224 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000225 return -1;
226 }
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000227 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
228 id > kVoiceEngineMaxRtpExtensionId))
niklase@google.com470e71d2011-07-07 08:21:25 +0000229 {
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000230 // [RFC5285] The 4-bit id is the local identifier of this element in
niklase@google.com470e71d2011-07-07 08:21:25 +0000231 // the range 1-14 inclusive.
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000232 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000233 "SetSendAudioLevelIndicationStatus() invalid ID parameter");
niklase@google.com470e71d2011-07-07 08:21:25 +0000234 return -1;
235 }
236
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000237 // Set state and id for the specified channel.
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000238 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
239 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000240 if (channelPtr == NULL)
241 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000242 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000243 "SetSendAudioLevelIndicationStatus() failed to locate channel");
niklase@google.com470e71d2011-07-07 08:21:25 +0000244 return -1;
245 }
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000246 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000247}
248
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000249int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel,
250 bool enable,
251 unsigned char id) {
252 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
253 "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
254 channel, enable, id);
255 if (!_shared->statistics().Initialized()) {
256 _shared->SetLastError(VE_NOT_INITED, kTraceError);
257 return -1;
258 }
259 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
260 id > kVoiceEngineMaxRtpExtensionId)) {
261 // [RFC5285] The 4-bit id is the local identifier of this element in
262 // the range 1-14 inclusive.
263 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
264 "SetSendAbsoluteSenderTimeStatus() invalid id parameter");
265 return -1;
266 }
267 // Set state and id for the specified channel.
268 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
269 voe::Channel* channelPtr = ch.channel();
270 if (channelPtr == NULL) {
271 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
272 "SetSendAbsoluteSenderTimeStatus() failed to locate channel");
273 return -1;
274 }
275 return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id);
276}
277
278int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel,
279 bool enable,
280 unsigned char id) {
281 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
282 "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
283 channel, enable, id);
284 if (!_shared->statistics().Initialized()) {
285 _shared->SetLastError(VE_NOT_INITED, kTraceError);
286 return -1;
287 }
288 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
289 id > kVoiceEngineMaxRtpExtensionId)) {
290 // [RFC5285] The 4-bit id is the local identifier of this element in
291 // the range 1-14 inclusive.
292 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
293 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
294 return -1;
295 }
296 // Set state and id for the specified channel.
297 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
298 voe::Channel* channelPtr = ch.channel();
299 if (channelPtr == NULL) {
300 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
301 "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel");
302 return -1;
303 }
304 return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000305}
306
307int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable)
308{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000309 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000310 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000311 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000312 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000313 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000314 return -1;
315 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000316 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
317 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000318 if (channelPtr == NULL)
319 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000320 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000321 "SetRTCPStatus() failed to locate channel");
322 return -1;
323 }
324 return channelPtr->SetRTCPStatus(enable);
325}
326
327int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled)
328{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000329 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000330 "GetRTCPStatus(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000331 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000332 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000333 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000334 return -1;
335 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000336 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
337 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000338 if (channelPtr == NULL)
339 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000340 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000341 "GetRTCPStatus() failed to locate channel");
342 return -1;
343 }
344 return channelPtr->GetRTCPStatus(enabled);
345}
346
347int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256])
348{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000349 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000350 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000351 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000352 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000353 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000354 return -1;
355 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000356 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
357 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000358 if (channelPtr == NULL)
359 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000360 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000361 "SetRTCP_CNAME() failed to locate channel");
362 return -1;
363 }
364 return channelPtr->SetRTCP_CNAME(cName);
365}
366
367int VoERTP_RTCPImpl::GetRTCP_CNAME(int channel, char cName[256])
368{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000369 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000370 "GetRTCP_CNAME(channel=%d, cName=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000371 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000372 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000373 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000374 return -1;
375 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000376 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
377 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000378 if (channelPtr == NULL)
379 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000380 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000381 "GetRTCP_CNAME() failed to locate channel");
382 return -1;
383 }
384 return channelPtr->GetRTCP_CNAME(cName);
385}
386
387int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256])
388{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000389 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000390 "GetRemoteRTCP_CNAME(channel=%d, cName=?)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000391 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000392 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000393 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000394 return -1;
395 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000396 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
397 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000398 if (channelPtr == NULL)
399 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000400 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000401 "GetRemoteRTCP_CNAME() failed to locate channel");
402 return -1;
403 }
404 return channelPtr->GetRemoteRTCP_CNAME(cName);
405}
406
407int VoERTP_RTCPImpl::GetRemoteRTCPData(
408 int channel,
409 unsigned int& NTPHigh, // from sender info in SR
410 unsigned int& NTPLow, // from sender info in SR
411 unsigned int& timestamp, // from sender info in SR
412 unsigned int& playoutTimestamp, // derived locally
413 unsigned int* jitter, // from report block 1 in SR/RR
414 unsigned short* fractionLost) // from report block 1 in SR/RR
415{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000416 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000417 "GetRemoteRTCPData(channel=%d,...)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000418 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000419 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000420 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000421 return -1;
422 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000423 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
424 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000425 if (channelPtr == NULL)
426 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000427 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000428 "GetRemoteRTCP_CNAME() failed to locate channel");
429 return -1;
430 }
431 return channelPtr->GetRemoteRTCPData(NTPHigh,
432 NTPLow,
433 timestamp,
434 playoutTimestamp,
435 jitter,
436 fractionLost);
437}
438
439int VoERTP_RTCPImpl::SendApplicationDefinedRTCPPacket(
440 int channel,
pbos@webrtc.org92135212013-05-14 08:31:39 +0000441 unsigned char subType,
niklase@google.com470e71d2011-07-07 08:21:25 +0000442 unsigned int name,
443 const char* data,
444 unsigned short dataLengthInBytes)
445{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000446 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000447 "SendApplicationDefinedRTCPPacket(channel=%d, subType=%u,"
448 "name=%u, data=?, dataLengthInBytes=%u)",
449 channel, subType, name, dataLengthInBytes);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000450 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000451 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000452 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000453 return -1;
454 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000455 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
456 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000457 if (channelPtr == NULL)
458 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000459 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000460 "SendApplicationDefinedRTCPPacket() failed to locate channel");
461 return -1;
462 }
463 return channelPtr->SendApplicationDefinedRTCPPacket(subType,
464 name,
465 data,
466 dataLengthInBytes);
467}
468
469int VoERTP_RTCPImpl::GetRTPStatistics(int channel,
470 unsigned int& averageJitterMs,
471 unsigned int& maxJitterMs,
472 unsigned int& discardedPackets)
473{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000474 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000475 "GetRTPStatistics(channel=%d,....)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000476 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000477 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000478 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000479 return -1;
480 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000481 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
482 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000483 if (channelPtr == NULL)
484 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000485 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000486 "GetRTPStatistics() failed to locate channel");
487 return -1;
488 }
489 return channelPtr->GetRTPStatistics(averageJitterMs,
490 maxJitterMs,
491 discardedPackets);
492}
493
494int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats)
495{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000496 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000497 "GetRTCPStatistics(channel=%d)", channel);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000498 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000499 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000500 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000501 return -1;
502 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000503 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
504 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000505 if (channelPtr == NULL)
506 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000507 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000508 "GetRTPStatistics() failed to locate channel");
509 return -1;
510 }
511 return channelPtr->GetRTPStatistics(stats);
512}
513
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000514int VoERTP_RTCPImpl::GetRemoteRTCPSenderInfo(int channel,
515 SenderInfo* sender_info) {
516 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
517 "GetRemoteRTCPSenderInfo(channel=%d)", channel);
518 if (!_shared->statistics().Initialized()) {
519 _shared->SetLastError(VE_NOT_INITED, kTraceError);
520 return -1;
521 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000522 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
523 voe::Channel* channel_ptr = ch.channel();
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000524 if (channel_ptr == NULL) {
525 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
526 "GetRemoteRTCPSenderInfo() failed to locate channel");
527 return -1;
528 }
529 return channel_ptr->GetRemoteRTCPSenderInfo(sender_info);
530}
531
532int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
533 int channel, std::vector<ReportBlock>* report_blocks) {
534 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
535 "GetRemoteRTCPReportBlocks(channel=%d)", channel);
536 if (!_shared->statistics().Initialized()) {
537 _shared->SetLastError(VE_NOT_INITED, kTraceError);
538 return -1;
539 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000540 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
541 voe::Channel* channel_ptr = ch.channel();
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000542 if (channel_ptr == NULL) {
543 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
544 "GetRemoteRTCPReportBlocks() failed to locate channel");
545 return -1;
546 }
547 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks);
548}
549
niklase@google.com470e71d2011-07-07 08:21:25 +0000550int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype)
551{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000552 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000553 "SetFECStatus(channel=%d, enable=%d, redPayloadtype=%d)",
554 channel, enable, redPayloadtype);
555#ifdef WEBRTC_CODEC_RED
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000556 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000557 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000558 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000559 return -1;
560 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000561 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
562 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000563 if (channelPtr == NULL)
564 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000565 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000566 "SetFECStatus() failed to locate channel");
567 return -1;
568 }
569 return channelPtr->SetFECStatus(enable, redPayloadtype);
570#else
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000571 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
572 "SetFECStatus() RED is not supported");
niklase@google.com470e71d2011-07-07 08:21:25 +0000573 return -1;
574#endif
575}
576
577int VoERTP_RTCPImpl::GetFECStatus(int channel,
578 bool& enabled,
579 int& redPayloadtype)
580{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000581 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000582 "GetFECStatus(channel=%d, enabled=?, redPayloadtype=?)",
583 channel);
584#ifdef WEBRTC_CODEC_RED
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000585 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000586 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000587 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000588 return -1;
589 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000590 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
591 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000592 if (channelPtr == NULL)
593 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000594 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000595 "GetFECStatus() failed to locate channel");
596 return -1;
597 }
598 return channelPtr->GetFECStatus(enabled, redPayloadtype);
599#else
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000600 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
601 "GetFECStatus() RED is not supported");
niklase@google.com470e71d2011-07-07 08:21:25 +0000602 return -1;
603#endif
604}
605
niklas.enbom@webrtc.orgb35d2e32013-05-31 21:13:52 +0000606
607int VoERTP_RTCPImpl::SetNACKStatus(int channel,
608 bool enable,
609 int maxNoPackets)
610{
611 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
612 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)",
613 channel, enable, maxNoPackets);
pwestin@webrtc.orgdb249952013-06-05 15:33:20 +0000614
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000615 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
616 voe::Channel* channelPtr = ch.channel();
pwestin@webrtc.orgdb249952013-06-05 15:33:20 +0000617 if (channelPtr == NULL)
618 {
619 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
620 "SetNACKStatus() failed to locate channel");
621 return -1;
622 }
623 channelPtr->SetNACKStatus(enable, maxNoPackets);
niklas.enbom@webrtc.orgb35d2e32013-05-31 21:13:52 +0000624 return 0;
625}
626
627
niklase@google.com470e71d2011-07-07 08:21:25 +0000628int VoERTP_RTCPImpl::StartRTPDump(int channel,
629 const char fileNameUTF8[1024],
630 RTPDirections direction)
631{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000632 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000633 "StartRTPDump(channel=%d, fileNameUTF8=%s, direction=%d)",
634 channel, fileNameUTF8, direction);
635 assert(1024 == FileWrapper::kMaxFileNameSize);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000636 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000637 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000638 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000639 return -1;
640 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000641 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
642 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000643 if (channelPtr == NULL)
644 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000645 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000646 "StartRTPDump() failed to locate channel");
647 return -1;
648 }
649 return channelPtr->StartRTPDump(fileNameUTF8, direction);
650}
651
652int VoERTP_RTCPImpl::StopRTPDump(int channel, RTPDirections direction)
653{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000654 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000655 "StopRTPDump(channel=%d, direction=%d)", channel, direction);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000656 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000657 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000658 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000659 return -1;
660 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000661 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
662 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000663 if (channelPtr == NULL)
664 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000665 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000666 "StopRTPDump() failed to locate channel");
667 return -1;
668 }
669 return channelPtr->StopRTPDump(direction);
670}
671
672int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction)
673{
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000674 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
niklase@google.com470e71d2011-07-07 08:21:25 +0000675 "RTPDumpIsActive(channel=%d, direction=%d)",
676 channel, direction);
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000677 if (!_shared->statistics().Initialized())
niklase@google.com470e71d2011-07-07 08:21:25 +0000678 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000679 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000680 return -1;
681 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000682 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
683 voe::Channel* channelPtr = ch.channel();
niklase@google.com470e71d2011-07-07 08:21:25 +0000684 if (channelPtr == NULL)
685 {
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000686 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
niklase@google.com470e71d2011-07-07 08:21:25 +0000687 "StopRTPDump() failed to locate channel");
688 return -1;
689 }
690 return channelPtr->RTPDumpIsActive(direction);
691}
692
roosa@google.com0870f022012-12-12 21:31:41 +0000693int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel,
694 uint32_t* timestamp) {
695 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
696 "GetLastRemoteTimeStamp(channel=%d, timestamp=?)", channel);
697 if (!_shared->statistics().Initialized())
698 {
699 _shared->SetLastError(VE_NOT_INITED, kTraceError);
700 return -1;
701 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000702 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
703 voe::Channel* channelPtr = ch.channel();
roosa@google.com0870f022012-12-12 21:31:41 +0000704 if (channelPtr == NULL)
705 {
706 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
707 "GetLastRemoteTimeStamp() failed to locate channel");
708 return -1;
709 }
710 *timestamp = channelPtr->LastRemoteTimeStamp();
711 return 0;
712}
713
solenberg@webrtc.orgb1f50102014-03-24 10:38:25 +0000714int VoERTP_RTCPImpl::SetVideoEngineBWETarget(int channel,
715 ViENetwork* vie_network,
716 int video_channel) {
717 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
718 "SetVideoEngineBWETarget(channel=%d, vie_network=?, video_channel=%d)",
719 channel, vie_network, video_channel);
720
721 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
722 voe::Channel* channelPtr = ch.channel();
723 if (channelPtr == NULL) {
724 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
725 "SetVideoEngineBWETarget() failed to locate channel");
726 if (vie_network) {
727 vie_network->Release();
728 }
729 return -1;
730 }
731 channelPtr->SetVideoEngineBWETarget(vie_network, video_channel);
732 return 0;
733}
734
niklase@google.com470e71d2011-07-07 08:21:25 +0000735#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
736
737} // namespace webrtc