OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/system_wrappers/include/file_wrapper.h" | 11 #include "webrtc/system_wrappers/include/file_wrapper.h" |
12 #include "webrtc/system_wrappers/include/trace.h" | 12 #include "webrtc/system_wrappers/include/trace.h" |
13 #include "webrtc/voice_engine/include/voe_errors.h" | 13 #include "webrtc/voice_engine/include/voe_errors.h" |
14 #include "webrtc/voice_engine/voe_rtp_rtcp_impl.h" | 14 #include "webrtc/voice_engine/voe_rtp_rtcp_impl.h" |
15 #include "webrtc/voice_engine/voice_engine_impl.h" | 15 #include "webrtc/voice_engine/voice_engine_impl.h" |
16 | 16 |
17 #include "webrtc/voice_engine/channel.h" | 17 #include "webrtc/voice_engine/channel.h" |
18 #include "webrtc/voice_engine/transmit_mixer.h" | 18 #include "webrtc/voice_engine/transmit_mixer.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) { | 22 VoERTP_RTCP* VoERTP_RTCP::GetInterface(VoiceEngine* voiceEngine) { |
23 if (NULL == voiceEngine) { | 23 if (nullptr == voiceEngine) { |
24 return NULL; | 24 return nullptr; |
25 } | 25 } |
26 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); | 26 VoiceEngineImpl* s = static_cast<VoiceEngineImpl*>(voiceEngine); |
27 s->AddRef(); | 27 s->AddRef(); |
28 return s; | 28 return s; |
29 } | 29 } |
30 | 30 |
31 VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) { | 31 VoERTP_RTCPImpl::VoERTP_RTCPImpl(voe::SharedData* shared) : _shared(shared) { |
32 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 32 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
33 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor"); | 33 "VoERTP_RTCPImpl::VoERTP_RTCPImpl() - ctor"); |
34 } | 34 } |
35 | 35 |
36 VoERTP_RTCPImpl::~VoERTP_RTCPImpl() { | 36 VoERTP_RTCPImpl::~VoERTP_RTCPImpl() { |
37 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 37 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
38 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor"); | 38 "VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor"); |
39 } | 39 } |
40 | 40 |
41 int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) { | 41 int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc) { |
42 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 42 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
43 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc); | 43 "SetLocalSSRC(channel=%d, %lu)", channel, ssrc); |
44 if (!_shared->statistics().Initialized()) { | 44 if (!_shared->statistics().Initialized()) { |
45 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 45 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
46 return -1; | 46 return -1; |
47 } | 47 } |
48 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 48 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
49 voe::Channel* channelPtr = ch.channel(); | 49 voe::Channel* channelPtr = ch.channel(); |
50 if (channelPtr == NULL) { | 50 if (channelPtr == nullptr) { |
51 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 51 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
52 "SetLocalSSRC() failed to locate channel"); | 52 "SetLocalSSRC() failed to locate channel"); |
53 return -1; | 53 return -1; |
54 } | 54 } |
55 return channelPtr->SetLocalSSRC(ssrc); | 55 return channelPtr->SetLocalSSRC(ssrc); |
56 } | 56 } |
57 | 57 |
58 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) { | 58 int VoERTP_RTCPImpl::GetLocalSSRC(int channel, unsigned int& ssrc) { |
59 if (!_shared->statistics().Initialized()) { | 59 if (!_shared->statistics().Initialized()) { |
60 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 60 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
61 return -1; | 61 return -1; |
62 } | 62 } |
63 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 63 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
64 voe::Channel* channelPtr = ch.channel(); | 64 voe::Channel* channelPtr = ch.channel(); |
65 if (channelPtr == NULL) { | 65 if (channelPtr == nullptr) { |
66 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 66 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
67 "GetLocalSSRC() failed to locate channel"); | 67 "GetLocalSSRC() failed to locate channel"); |
68 return -1; | 68 return -1; |
69 } | 69 } |
70 return channelPtr->GetLocalSSRC(ssrc); | 70 return channelPtr->GetLocalSSRC(ssrc); |
71 } | 71 } |
72 | 72 |
73 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) { | 73 int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc) { |
74 if (!_shared->statistics().Initialized()) { | 74 if (!_shared->statistics().Initialized()) { |
75 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 75 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
76 return -1; | 76 return -1; |
77 } | 77 } |
78 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 78 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
79 voe::Channel* channelPtr = ch.channel(); | 79 voe::Channel* channelPtr = ch.channel(); |
80 if (channelPtr == NULL) { | 80 if (channelPtr == nullptr) { |
81 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 81 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
82 "GetRemoteSSRC() failed to locate channel"); | 82 "GetRemoteSSRC() failed to locate channel"); |
83 return -1; | 83 return -1; |
84 } | 84 } |
85 return channelPtr->GetRemoteSSRC(ssrc); | 85 return channelPtr->GetRemoteSSRC(ssrc); |
86 } | 86 } |
87 | 87 |
88 int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel, | 88 int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel, |
89 bool enable, | 89 bool enable, |
90 unsigned char id) { | 90 unsigned char id) { |
(...skipping 11 matching lines...) Expand all Loading... |
102 // the range 1-14 inclusive. | 102 // the range 1-14 inclusive. |
103 _shared->SetLastError( | 103 _shared->SetLastError( |
104 VE_INVALID_ARGUMENT, kTraceError, | 104 VE_INVALID_ARGUMENT, kTraceError, |
105 "SetSendAudioLevelIndicationStatus() invalid ID parameter"); | 105 "SetSendAudioLevelIndicationStatus() invalid ID parameter"); |
106 return -1; | 106 return -1; |
107 } | 107 } |
108 | 108 |
109 // Set state and id for the specified channel. | 109 // Set state and id for the specified channel. |
110 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 110 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
111 voe::Channel* channelPtr = ch.channel(); | 111 voe::Channel* channelPtr = ch.channel(); |
112 if (channelPtr == NULL) { | 112 if (channelPtr == nullptr) { |
113 _shared->SetLastError( | 113 _shared->SetLastError( |
114 VE_CHANNEL_NOT_VALID, kTraceError, | 114 VE_CHANNEL_NOT_VALID, kTraceError, |
115 "SetSendAudioLevelIndicationStatus() failed to locate channel"); | 115 "SetSendAudioLevelIndicationStatus() failed to locate channel"); |
116 return -1; | 116 return -1; |
117 } | 117 } |
118 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); | 118 return channelPtr->SetSendAudioLevelIndicationStatus(enable, id); |
119 } | 119 } |
120 | 120 |
121 int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel, | 121 int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel, |
122 bool enable, | 122 bool enable, |
(...skipping 11 matching lines...) Expand all Loading... |
134 // [RFC5285] The 4-bit id is the local identifier of this element in | 134 // [RFC5285] The 4-bit id is the local identifier of this element in |
135 // the range 1-14 inclusive. | 135 // the range 1-14 inclusive. |
136 _shared->SetLastError( | 136 _shared->SetLastError( |
137 VE_INVALID_ARGUMENT, kTraceError, | 137 VE_INVALID_ARGUMENT, kTraceError, |
138 "SetReceiveAudioLevelIndicationStatus() invalid id parameter"); | 138 "SetReceiveAudioLevelIndicationStatus() invalid id parameter"); |
139 return -1; | 139 return -1; |
140 } | 140 } |
141 // Set state and id for the specified channel. | 141 // Set state and id for the specified channel. |
142 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 142 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
143 voe::Channel* channel_ptr = ch.channel(); | 143 voe::Channel* channel_ptr = ch.channel(); |
144 if (channel_ptr == NULL) { | 144 if (channel_ptr == nullptr) { |
145 _shared->SetLastError( | 145 _shared->SetLastError( |
146 VE_CHANNEL_NOT_VALID, kTraceError, | 146 VE_CHANNEL_NOT_VALID, kTraceError, |
147 "SetReceiveAudioLevelIndicationStatus() failed to locate channel"); | 147 "SetReceiveAudioLevelIndicationStatus() failed to locate channel"); |
148 return -1; | 148 return -1; |
149 } | 149 } |
150 return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id); | 150 return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id); |
151 } | 151 } |
152 | 152 |
153 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) { | 153 int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) { |
154 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 154 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
155 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); | 155 "SetRTCPStatus(channel=%d, enable=%d)", channel, enable); |
156 if (!_shared->statistics().Initialized()) { | 156 if (!_shared->statistics().Initialized()) { |
157 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 157 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
158 return -1; | 158 return -1; |
159 } | 159 } |
160 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 160 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
161 voe::Channel* channelPtr = ch.channel(); | 161 voe::Channel* channelPtr = ch.channel(); |
162 if (channelPtr == NULL) { | 162 if (channelPtr == nullptr) { |
163 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 163 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
164 "SetRTCPStatus() failed to locate channel"); | 164 "SetRTCPStatus() failed to locate channel"); |
165 return -1; | 165 return -1; |
166 } | 166 } |
167 channelPtr->SetRTCPStatus(enable); | 167 channelPtr->SetRTCPStatus(enable); |
168 return 0; | 168 return 0; |
169 } | 169 } |
170 | 170 |
171 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) { | 171 int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled) { |
172 if (!_shared->statistics().Initialized()) { | 172 if (!_shared->statistics().Initialized()) { |
173 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 173 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
174 return -1; | 174 return -1; |
175 } | 175 } |
176 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 176 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
177 voe::Channel* channelPtr = ch.channel(); | 177 voe::Channel* channelPtr = ch.channel(); |
178 if (channelPtr == NULL) { | 178 if (channelPtr == nullptr) { |
179 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 179 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
180 "GetRTCPStatus() failed to locate channel"); | 180 "GetRTCPStatus() failed to locate channel"); |
181 return -1; | 181 return -1; |
182 } | 182 } |
183 return channelPtr->GetRTCPStatus(enabled); | 183 return channelPtr->GetRTCPStatus(enabled); |
184 } | 184 } |
185 | 185 |
186 int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) { | 186 int VoERTP_RTCPImpl::SetRTCP_CNAME(int channel, const char cName[256]) { |
187 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 187 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
188 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName); | 188 "SetRTCP_CNAME(channel=%d, cName=%s)", channel, cName); |
189 if (!_shared->statistics().Initialized()) { | 189 if (!_shared->statistics().Initialized()) { |
190 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 190 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
191 return -1; | 191 return -1; |
192 } | 192 } |
193 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 193 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
194 voe::Channel* channelPtr = ch.channel(); | 194 voe::Channel* channelPtr = ch.channel(); |
195 if (channelPtr == NULL) { | 195 if (channelPtr == nullptr) { |
196 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 196 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
197 "SetRTCP_CNAME() failed to locate channel"); | 197 "SetRTCP_CNAME() failed to locate channel"); |
198 return -1; | 198 return -1; |
199 } | 199 } |
200 return channelPtr->SetRTCP_CNAME(cName); | 200 return channelPtr->SetRTCP_CNAME(cName); |
201 } | 201 } |
202 | 202 |
203 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) { | 203 int VoERTP_RTCPImpl::GetRemoteRTCP_CNAME(int channel, char cName[256]) { |
204 if (!_shared->statistics().Initialized()) { | 204 if (!_shared->statistics().Initialized()) { |
205 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 205 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
206 return -1; | 206 return -1; |
207 } | 207 } |
208 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 208 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
209 voe::Channel* channelPtr = ch.channel(); | 209 voe::Channel* channelPtr = ch.channel(); |
210 if (channelPtr == NULL) { | 210 if (channelPtr == nullptr) { |
211 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 211 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
212 "GetRemoteRTCP_CNAME() failed to locate channel"); | 212 "GetRemoteRTCP_CNAME() failed to locate channel"); |
213 return -1; | 213 return -1; |
214 } | 214 } |
215 return channelPtr->GetRemoteRTCP_CNAME(cName); | 215 return channelPtr->GetRemoteRTCP_CNAME(cName); |
216 } | 216 } |
217 | 217 |
218 int VoERTP_RTCPImpl::GetRemoteRTCPData( | 218 int VoERTP_RTCPImpl::GetRemoteRTCPData( |
219 int channel, | 219 int channel, |
220 unsigned int& NTPHigh, // from sender info in SR | 220 unsigned int& NTPHigh, // from sender info in SR |
221 unsigned int& NTPLow, // from sender info in SR | 221 unsigned int& NTPLow, // from sender info in SR |
222 unsigned int& timestamp, // from sender info in SR | 222 unsigned int& timestamp, // from sender info in SR |
223 unsigned int& playoutTimestamp, // derived locally | 223 unsigned int& playoutTimestamp, // derived locally |
224 unsigned int* jitter, // from report block 1 in SR/RR | 224 unsigned int* jitter, // from report block 1 in SR/RR |
225 unsigned short* fractionLost) // from report block 1 in SR/RR | 225 unsigned short* fractionLost) // from report block 1 in SR/RR |
226 { | 226 { |
227 if (!_shared->statistics().Initialized()) { | 227 if (!_shared->statistics().Initialized()) { |
228 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 228 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
229 return -1; | 229 return -1; |
230 } | 230 } |
231 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 231 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
232 voe::Channel* channelPtr = ch.channel(); | 232 voe::Channel* channelPtr = ch.channel(); |
233 if (channelPtr == NULL) { | 233 if (channelPtr == nullptr) { |
234 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 234 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
235 "GetRemoteRTCP_CNAME() failed to locate channel"); | 235 "GetRemoteRTCP_CNAME() failed to locate channel"); |
236 return -1; | 236 return -1; |
237 } | 237 } |
238 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp, | 238 return channelPtr->GetRemoteRTCPData(NTPHigh, NTPLow, timestamp, |
239 playoutTimestamp, jitter, fractionLost); | 239 playoutTimestamp, jitter, fractionLost); |
240 } | 240 } |
241 | 241 |
242 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, | 242 int VoERTP_RTCPImpl::GetRTPStatistics(int channel, |
243 unsigned int& averageJitterMs, | 243 unsigned int& averageJitterMs, |
244 unsigned int& maxJitterMs, | 244 unsigned int& maxJitterMs, |
245 unsigned int& discardedPackets) { | 245 unsigned int& discardedPackets) { |
246 if (!_shared->statistics().Initialized()) { | 246 if (!_shared->statistics().Initialized()) { |
247 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 247 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
248 return -1; | 248 return -1; |
249 } | 249 } |
250 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 250 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
251 voe::Channel* channelPtr = ch.channel(); | 251 voe::Channel* channelPtr = ch.channel(); |
252 if (channelPtr == NULL) { | 252 if (channelPtr == nullptr) { |
253 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 253 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
254 "GetRTPStatistics() failed to locate channel"); | 254 "GetRTPStatistics() failed to locate channel"); |
255 return -1; | 255 return -1; |
256 } | 256 } |
257 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs, | 257 return channelPtr->GetRTPStatistics(averageJitterMs, maxJitterMs, |
258 discardedPackets); | 258 discardedPackets); |
259 } | 259 } |
260 | 260 |
261 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { | 261 int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats) { |
262 if (!_shared->statistics().Initialized()) { | 262 if (!_shared->statistics().Initialized()) { |
263 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 263 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
264 return -1; | 264 return -1; |
265 } | 265 } |
266 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 266 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
267 voe::Channel* channelPtr = ch.channel(); | 267 voe::Channel* channelPtr = ch.channel(); |
268 if (channelPtr == NULL) { | 268 if (channelPtr == nullptr) { |
269 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 269 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
270 "GetRTPStatistics() failed to locate channel"); | 270 "GetRTPStatistics() failed to locate channel"); |
271 return -1; | 271 return -1; |
272 } | 272 } |
273 return channelPtr->GetRTPStatistics(stats); | 273 return channelPtr->GetRTPStatistics(stats); |
274 } | 274 } |
275 | 275 |
276 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( | 276 int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks( |
277 int channel, std::vector<ReportBlock>* report_blocks) { | 277 int channel, std::vector<ReportBlock>* report_blocks) { |
278 if (!_shared->statistics().Initialized()) { | 278 if (!_shared->statistics().Initialized()) { |
279 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 279 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
280 return -1; | 280 return -1; |
281 } | 281 } |
282 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 282 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
283 voe::Channel* channel_ptr = ch.channel(); | 283 voe::Channel* channel_ptr = ch.channel(); |
284 if (channel_ptr == NULL) { | 284 if (channel_ptr == nullptr) { |
285 _shared->SetLastError( | 285 _shared->SetLastError( |
286 VE_CHANNEL_NOT_VALID, kTraceError, | 286 VE_CHANNEL_NOT_VALID, kTraceError, |
287 "GetRemoteRTCPReportBlocks() failed to locate channel"); | 287 "GetRemoteRTCPReportBlocks() failed to locate channel"); |
288 return -1; | 288 return -1; |
289 } | 289 } |
290 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); | 290 return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks); |
291 } | 291 } |
292 | 292 |
293 int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { | 293 int VoERTP_RTCPImpl::SetNACKStatus(int channel, bool enable, int maxNoPackets) { |
294 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 294 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
295 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, | 295 "SetNACKStatus(channel=%d, enable=%d, maxNoPackets=%d)", channel, |
296 enable, maxNoPackets); | 296 enable, maxNoPackets); |
297 | 297 |
298 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); | 298 voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); |
299 voe::Channel* channelPtr = ch.channel(); | 299 voe::Channel* channelPtr = ch.channel(); |
300 if (channelPtr == NULL) { | 300 if (channelPtr == nullptr) { |
301 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, | 301 _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |
302 "SetNACKStatus() failed to locate channel"); | 302 "SetNACKStatus() failed to locate channel"); |
303 return -1; | 303 return -1; |
304 } | 304 } |
305 channelPtr->SetNACKStatus(enable, maxNoPackets); | 305 channelPtr->SetNACKStatus(enable, maxNoPackets); |
306 return 0; | 306 return 0; |
307 } | 307 } |
308 | 308 |
309 } // namespace webrtc | 309 } // namespace webrtc |
OLD | NEW |