blob: ab70feecbe85aafb37c8500c129cdabf8e5b0b5e [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
Henrik Kjellander98f53512015-10-28 18:17:40 +010011#include "webrtc/system_wrappers/include/file_wrapper.h"
12#include "webrtc/system_wrappers/include/trace.h"
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000013#include "webrtc/voice_engine/include/voe_errors.h"
14#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
15#include "webrtc/voice_engine/voice_engine_impl.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000017#include "webrtc/voice_engine/channel.h"
18#include "webrtc/voice_engine/transmit_mixer.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000019
20namespace webrtc {
21
Jelena Marusic0d266052015-05-04 14:15:32 +020022VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) {
niklase@google.com470e71d2011-07-07 08:21:25 +000023#ifndef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
Jelena Marusic0d266052015-05-04 14:15:32 +020024 return NULL;
niklase@google.com470e71d2011-07-07 08:21:25 +000025#else
Jelena Marusic0d266052015-05-04 14:15:32 +020026 if (NULL == voiceEngine) {
27 return NULL;
28 }
29 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine);
30 s->AddRef();
31 return s;
niklase@google.com470e71d2011-07-07 08:21:25 +000032#endif
33}
34
35#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
36
Jelena Marusic0d266052015-05-04 14:15:32 +020037VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) {
38 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
39 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor");
niklase@google.com470e71d2011-07-07 08:21:25 +000040}
41
Jelena Marusic0d266052015-05-04 14:15:32 +020042VoERTP_RTCPImpl::~VoERTP_RTCPImpl() {
43 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1),
44 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
niklase@google.com470e71d2011-07-07 08:21:25 +000045}
46
Jelena Marusic0d266052015-05-04 14:15:32 +020047int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) {
48 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
49 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc);
50 if (!_shared->statistics().Initialized()) {
51 _shared->SetLastError(VE_NOT_INITED, kTraceError);
52 return -1;
53 }
54 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
55 voe::Channel* channelPtr = ch.channel();
56 if (channelPtr == NULL) {
57 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
58 "SetLocalSSRC() failed to locate channel");
59 return -1;
60 }
61 return channelPtr->SetLocalSSRC(ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000062}
63
Jelena Marusic0d266052015-05-04 14:15:32 +020064int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) {
Jelena Marusic0d266052015-05-04 14:15:32 +020065 if (!_shared->statistics().Initialized()) {
66 _shared->SetLastError(VE_NOT_INITED, kTraceError);
67 return -1;
68 }
69 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
70 voe::Channel* channelPtr = ch.channel();
71 if (channelPtr == NULL) {
72 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
73 "GetLocalSSRC() failed to locate channel");
74 return -1;
75 }
76 return channelPtr->GetLocalSSRC(ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000077}
78
Jelena Marusic0d266052015-05-04 14:15:32 +020079int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) {
Jelena Marusic0d266052015-05-04 14:15:32 +020080 if (!_shared->statistics().Initialized()) {
81 _shared->SetLastError(VE_NOT_INITED, kTraceError);
82 return -1;
83 }
84 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
85 voe::Channel* channelPtr = ch.channel();
86 if (channelPtr == NULL) {
87 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
88 "GetRemoteSSRC() failed to locate channel");
89 return -1;
90 }
91 return channelPtr->GetRemoteSSRC(ssrc);
niklase@google.com470e71d2011-07-07 08:21:25 +000092}
93
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +000094int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
95 bool enable,
Jelena Marusic0d266052015-05-04 14:15:32 +020096 unsigned char id) {
97 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
98 "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d,"
99 " ID=%u)",
100 channel, enable, id);
101 if (!_shared->statistics().Initialized()) {
102 _shared->SetLastError(VE_NOT_INITED, kTraceError);
103 return -1;
104 }
105 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
106 id > kVoiceEngineMaxRtpExtensionId)) {
107 // [RFC5285] The 4-bit id is the local identifier of this element in
108 // the range 1-14 inclusive.
109 _shared->SetLastError(
110 VE_INVALID_ARGUMENT, kTraceError,
111 "SetSendAudioLevelIndicationStatus() invalid ID parameter");
112 return -1;
113 }
niklase@google.com470e71d2011-07-07 08:21:25 +0000114
Jelena Marusic0d266052015-05-04 14:15:32 +0200115 // Set state and id for the specified channel.
116 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
117 voe::Channel* channelPtr = ch.channel();
118 if (channelPtr == NULL) {
119 _shared->SetLastError(
120 VE_CHANNEL_NOT_VALID, kTraceError,
121 "SetSendAudioLevelIndicationStatus() failed to locate channel");
122 return -1;
123 }
124 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000125}
126
wu@webrtc.org93fd25c2014-04-24 20:33:08 +0000127int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel,
128 bool enable,
129 unsigned char id) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200130 WEBRTC_TRACE(
131 kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
wu@webrtc.org93fd25c2014-04-24 20:33:08 +0000132 "SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)",
133 channel, enable, id);
134 if (!_shared->statistics().Initialized()) {
135 _shared->SetLastError(VE_NOT_INITED, kTraceError);
136 return -1;
137 }
Jelena Marusic0d266052015-05-04 14:15:32 +0200138 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
139 id > kVoiceEngineMaxRtpExtensionId)) {
wu@webrtc.org93fd25c2014-04-24 20:33:08 +0000140 // [RFC5285] The 4-bit id is the local identifier of this element in
141 // the range 1-14 inclusive.
Jelena Marusic0d266052015-05-04 14:15:32 +0200142 _shared->SetLastError(
143 VE_INVALID_ARGUMENT, kTraceError,
wu@webrtc.org93fd25c2014-04-24 20:33:08 +0000144 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
145 return -1;
146 }
147 // Set state and id for the specified channel.
148 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
149 voe::Channel* channel_ptr = ch.channel();
150 if (channel_ptr == NULL) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200151 _shared->SetLastError(
152 VE_CHANNEL_NOT_VALID, kTraceError,
wu@webrtc.org93fd25c2014-04-24 20:33:08 +0000153 "SetReceiveAudioLevelIndicationStatus() failed to locate channel");
154 return -1;
155 }
156 return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id);
157}
158
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000159int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel,
160 bool enable,
161 unsigned char id) {
162 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
163 "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
164 channel, enable, id);
165 if (!_shared->statistics().Initialized()) {
166 _shared->SetLastError(VE_NOT_INITED, kTraceError);
167 return -1;
168 }
169 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
170 id > kVoiceEngineMaxRtpExtensionId)) {
171 // [RFC5285] The 4-bit id is the local identifier of this element in
172 // the range 1-14 inclusive.
Jelena Marusic0d266052015-05-04 14:15:32 +0200173 _shared->SetLastError(
174 VE_INVALID_ARGUMENT, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000175 "SetSendAbsoluteSenderTimeStatus() invalid id parameter");
176 return -1;
177 }
178 // Set state and id for the specified channel.
179 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
180 voe::Channel* channelPtr = ch.channel();
181 if (channelPtr == NULL) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200182 _shared->SetLastError(
183 VE_CHANNEL_NOT_VALID, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000184 "SetSendAbsoluteSenderTimeStatus() failed to locate channel");
185 return -1;
186 }
187 return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id);
188}
189
190int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel,
191 bool enable,
192 unsigned char id) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200193 WEBRTC_TRACE(
194 kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000195 "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
196 channel, enable, id);
197 if (!_shared->statistics().Initialized()) {
198 _shared->SetLastError(VE_NOT_INITED, kTraceError);
199 return -1;
200 }
201 if (enable && (id < kVoiceEngineMinRtpExtensionId ||
202 id > kVoiceEngineMaxRtpExtensionId)) {
203 // [RFC5285] The 4-bit id is the local identifier of this element in
204 // the range 1-14 inclusive.
Jelena Marusic0d266052015-05-04 14:15:32 +0200205 _shared->SetLastError(
206 VE_INVALID_ARGUMENT, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000207 "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
208 return -1;
209 }
210 // Set state and id for the specified channel.
211 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
212 voe::Channel* channelPtr = ch.channel();
213 if (channelPtr == NULL) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200214 _shared->SetLastError(
215 VE_CHANNEL_NOT_VALID, kTraceError,
wu@webrtc.orgebdb0e32014-03-06 23:49:08 +0000216 "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel");
217 return -1;
218 }
219 return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id);
niklase@google.com470e71d2011-07-07 08:21:25 +0000220}
221
Jelena Marusic0d266052015-05-04 14:15:32 +0200222int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) {
223 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
224 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable);
225 if (!_shared->statistics().Initialized()) {
226 _shared->SetLastError(VE_NOT_INITED, kTraceError);
227 return -1;
228 }
229 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
230 voe::Channel* channelPtr = ch.channel();
231 if (channelPtr == NULL) {
232 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
233 "SetRTCPStatus() failed to locate channel");
234 return -1;
235 }
236 channelPtr->SetRTCPStatus(enable);
237 return 0;
niklase@google.com470e71d2011-07-07 08:21:25 +0000238}
239
Jelena Marusic0d266052015-05-04 14:15:32 +0200240int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200241 if (!_shared->statistics().Initialized()) {
242 _shared->SetLastError(VE_NOT_INITED, kTraceError);
243 return -1;
244 }
245 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
246 voe::Channel* channelPtr = ch.channel();
247 if (channelPtr == NULL) {
248 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
249 "GetRTCPStatus() failed to locate channel");
250 return -1;
251 }
252 return channelPtr->GetRTCPStatus(enabled);
niklase@google.com470e71d2011-07-07 08:21:25 +0000253}
254
Jelena Marusic0d266052015-05-04 14:15:32 +0200255int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) {
256 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
257 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName);
258 if (!_shared->statistics().Initialized()) {
259 _shared->SetLastError(VE_NOT_INITED, kTraceError);
260 return -1;
261 }
262 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
263 voe::Channel* channelPtr = ch.channel();
264 if (channelPtr == NULL) {
265 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
266 "SetRTCP_CNAME() failed to locate channel");
267 return -1;
268 }
269 return channelPtr->SetRTCP_CNAME(cName);
niklase@google.com470e71d2011-07-07 08:21:25 +0000270}
271
Jelena Marusic0d266052015-05-04 14:15:32 +0200272int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200273 if (!_shared->statistics().Initialized()) {
274 _shared->SetLastError(VE_NOT_INITED, kTraceError);
275 return -1;
276 }
277 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
278 voe::Channel* channelPtr = ch.channel();
279 if (channelPtr == NULL) {
280 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
281 "GetRemoteRTCP_CNAME() failed to locate channel");
282 return -1;
283 }
284 return channelPtr->GetRemoteRTCP_CNAME(cName);
niklase@google.com470e71d2011-07-07 08:21:25 +0000285}
286
287int VoERTP_RTCPImpl::GetRemoteRTCPData(
288 int channel,
Jelena Marusic0d266052015-05-04 14:15:32 +0200289 unsigned int& NTPHigh, // from sender info in SR
290 unsigned int& NTPLow, // from sender info in SR
291 unsigned int& timestamp, // from sender info in SR
292 unsigned int& playoutTimestamp, // derived locally
293 unsigned int* jitter, // from report block 1 in SR/RR
294 unsigned short* fractionLost) // from report block 1 in SR/RR
niklase@google.com470e71d2011-07-07 08:21:25 +0000295{
Jelena Marusic0d266052015-05-04 14:15:32 +0200296 if (!_shared->statistics().Initialized()) {
297 _shared->SetLastError(VE_NOT_INITED, kTraceError);
298 return -1;
299 }
300 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
301 voe::Channel* channelPtr = ch.channel();
302 if (channelPtr == NULL) {
303 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
304 "GetRemoteRTCP_CNAME() failed to locate channel");
305 return -1;
306 }
307 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp,
308 playoutTimestamp, jitter, fractionLost);
niklase@google.com470e71d2011-07-07 08:21:25 +0000309}
310
niklase@google.com470e71d2011-07-07 08:21:25 +0000311int VoERTP_RTCPImpl::GetRTPStatistics(int channel,
312 unsigned int& averageJitterMs,
313 unsigned int& maxJitterMs,
Jelena Marusic0d266052015-05-04 14:15:32 +0200314 unsigned int& discardedPackets) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200315 if (!_shared->statistics().Initialized()) {
316 _shared->SetLastError(VE_NOT_INITED, kTraceError);
317 return -1;
318 }
319 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
320 voe::Channel* channelPtr = ch.channel();
321 if (channelPtr == NULL) {
322 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
323 "GetRTPStatistics() failed to locate channel");
324 return -1;
325 }
326 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs,
327 discardedPackets);
niklase@google.com470e71d2011-07-07 08:21:25 +0000328}
329
Jelena Marusic0d266052015-05-04 14:15:32 +0200330int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200331 if (!_shared->statistics().Initialized()) {
332 _shared->SetLastError(VE_NOT_INITED, kTraceError);
333 return -1;
334 }
335 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
336 voe::Channel* channelPtr = ch.channel();
337 if (channelPtr == NULL) {
338 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
339 "GetRTPStatistics() failed to locate channel");
340 return -1;
341 }
342 return channelPtr->GetRTPStatistics(stats);
niklase@google.com470e71d2011-07-07 08:21:25 +0000343}
344
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000345int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
346 int channel, std::vector<ReportBlock>* report_blocks) {
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000347 if (!_shared->statistics().Initialized()) {
348 _shared->SetLastError(VE_NOT_INITED, kTraceError);
349 return -1;
350 }
pbos@webrtc.org676ff1e2013-08-07 17:57:36 +0000351 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
352 voe::Channel* channel_ptr = ch.channel();
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000353 if (channel_ptr == NULL) {
Jelena Marusic0d266052015-05-04 14:15:32 +0200354 _shared->SetLastError(
355 VE_CHANNEL_NOT_VALID, kTraceError,
henrika@webrtc.org8a2fc882012-08-22 08:53:55 +0000356 "GetRemoteRTCPReportBlocks() failed to locate channel");
357 return -1;
358 }
359 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks);
360}
361
Jelena Marusic0d266052015-05-04 14:15:32 +0200362int VoERTP_RTCPImpl::SetREDStatus(int channel,
363 bool enable,
364 int redPayloadtype) {
365 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
366 "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)",
367 channel, enable, redPayloadtype);
niklase@google.com470e71d2011-07-07 08:21:25 +0000368#ifdef WEBRTC_CODEC_RED
Jelena Marusic0d266052015-05-04 14:15:32 +0200369 if (!_shared->statistics().Initialized()) {
370 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000371 return -1;
Jelena Marusic0d266052015-05-04 14:15:32 +0200372 }
373 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
374 voe::Channel* channelPtr = ch.channel();
375 if (channelPtr == NULL) {
376 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
377 "SetREDStatus() failed to locate channel");
378 return -1;
379 }
380 return channelPtr->SetREDStatus(enable, redPayloadtype);
381#else
382 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
383 "SetREDStatus() RED is not supported");
384 return -1;
niklase@google.com470e71d2011-07-07 08:21:25 +0000385#endif
386}
387
minyue@webrtc.orgc1a40a72014-05-28 09:52:06 +0000388int VoERTP_RTCPImpl::GetREDStatus(int channel,
niklase@google.com470e71d2011-07-07 08:21:25 +0000389 bool& enabled,
Jelena Marusic0d266052015-05-04 14:15:32 +0200390 int& redPayloadtype) {
niklase@google.com470e71d2011-07-07 08:21:25 +0000391#ifdef WEBRTC_CODEC_RED
Jelena Marusic0d266052015-05-04 14:15:32 +0200392 if (!_shared->statistics().Initialized()) {
393 _shared->SetLastError(VE_NOT_INITED, kTraceError);
niklase@google.com470e71d2011-07-07 08:21:25 +0000394 return -1;
Jelena Marusic0d266052015-05-04 14:15:32 +0200395 }
396 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
397 voe::Channel* channelPtr = ch.channel();
398 if (channelPtr == NULL) {
399 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
400 "GetREDStatus() failed to locate channel");
401 return -1;
402 }
403 return channelPtr->GetREDStatus(enabled, redPayloadtype);
404#else
405 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
406 "GetREDStatus() RED is not supported");
407 return -1;
niklase@google.com470e71d2011-07-07 08:21:25 +0000408#endif
409}
410
Jelena Marusic0d266052015-05-04 14:15:32 +0200411int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) {
412 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
413 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel,
414 enable, maxNoPackets);
pwestin@webrtc.orgdb249952013-06-05 15:33:20 +0000415
Jelena Marusic0d266052015-05-04 14:15:32 +0200416 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
417 voe::Channel* channelPtr = ch.channel();
418 if (channelPtr == NULL) {
419 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
420 "SetNACKStatus() failed to locate channel");
421 return -1;
422 }
423 channelPtr->SetNACKStatus(enable, maxNoPackets);
424 return 0;
niklas.enbom@webrtc.orgb35d2e32013-05-31 21:13:52 +0000425}
426
niklase@google.com470e71d2011-07-07 08:21:25 +0000427#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
428
429} // namespace webrtc