| 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 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 void Channel::OnPlayTelephoneEvent(uint8_t event, | 356 void Channel::OnPlayTelephoneEvent(uint8_t event, |
| 357 uint16_t lengthMs, | 357 uint16_t lengthMs, |
| 358 uint8_t volume) { | 358 uint8_t volume) { |
| 359 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), | 359 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
| 360 "Channel::OnPlayTelephoneEvent(event=%u, lengthMs=%u," | 360 "Channel::OnPlayTelephoneEvent(event=%u, lengthMs=%u," |
| 361 " volume=%u)", | 361 " volume=%u)", |
| 362 event, lengthMs, volume); | 362 event, lengthMs, volume); |
| 363 | 363 |
| 364 if (!_playOutbandDtmfEvent || (event > 15)) { | 364 if (!_playOutbandDtmfEvent || event > 15) { |
| 365 // Ignore callback since feedback is disabled or event is not a | 365 // Ignore callback since feedback is disabled or event is not a |
| 366 // Dtmf tone event. | 366 // Dtmf tone event. |
| 367 return; | 367 return; |
| 368 } | 368 } |
| 369 | 369 |
| 370 assert(_outputMixerPtr != NULL); | 370 assert(_outputMixerPtr != NULL); |
| 371 | 371 |
| 372 // Start playing out the Dtmf tone (if playout is enabled). | 372 // Start playing out the Dtmf tone (if playout is enabled). |
| 373 // Reduce length of tone with 80ms to the reduce risk of echo. | 373 // Reduce length of tone with 80ms to the reduce risk of echo. |
| 374 _outputMixerPtr->PlayDtmfTone(event, lengthMs - 80, volume); | 374 _outputMixerPtr->PlayDtmfTone(event, lengthMs - 80, volume); |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 if (_rtpRtcpModule->SendTelephoneEventOutband( | 2220 if (_rtpRtcpModule->SendTelephoneEventOutband( |
| 2221 event, duration_ms, kTelephoneEventAttenuationdB) != 0) { | 2221 event, duration_ms, kTelephoneEventAttenuationdB) != 0) { |
| 2222 _engineStatisticsPtr->SetLastError( | 2222 _engineStatisticsPtr->SetLastError( |
| 2223 VE_SEND_DTMF_FAILED, kTraceWarning, | 2223 VE_SEND_DTMF_FAILED, kTraceWarning, |
| 2224 "SendTelephoneEventOutband() failed to send event"); | 2224 "SendTelephoneEventOutband() failed to send event"); |
| 2225 return -1; | 2225 return -1; |
| 2226 } | 2226 } |
| 2227 return 0; | 2227 return 0; |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 int Channel::SetSendTelephoneEventPayloadType(unsigned char type) { | 2230 int Channel::SetSendTelephoneEventPayloadType(int payload_type) { |
| 2231 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 2231 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
| 2232 "Channel::SetSendTelephoneEventPayloadType()"); | 2232 "Channel::SetSendTelephoneEventPayloadType()"); |
| 2233 if (type > 127) { | 2233 RTC_DCHECK_LE(0, payload_type); |
| 2234 _engineStatisticsPtr->SetLastError( | 2234 RTC_DCHECK_GE(127, payload_type); |
| 2235 VE_INVALID_ARGUMENT, kTraceError, | 2235 CodecInst codec = {0}; |
| 2236 "SetSendTelephoneEventPayloadType() invalid type"); | |
| 2237 return -1; | |
| 2238 } | |
| 2239 CodecInst codec = {}; | |
| 2240 codec.plfreq = 8000; | 2236 codec.plfreq = 8000; |
| 2241 codec.pltype = type; | 2237 codec.pltype = payload_type; |
| 2242 memcpy(codec.plname, "telephone-event", 16); | 2238 memcpy(codec.plname, "telephone-event", 16); |
| 2243 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 2239 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
| 2244 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); | 2240 _rtpRtcpModule->DeRegisterSendPayload(codec.pltype); |
| 2245 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { | 2241 if (_rtpRtcpModule->RegisterSendPayload(codec) != 0) { |
| 2246 _engineStatisticsPtr->SetLastError( | 2242 _engineStatisticsPtr->SetLastError( |
| 2247 VE_RTP_RTCP_MODULE_ERROR, kTraceError, | 2243 VE_RTP_RTCP_MODULE_ERROR, kTraceError, |
| 2248 "SetSendTelephoneEventPayloadType() failed to register send" | 2244 "SetSendTelephoneEventPayloadType() failed to register send" |
| 2249 "payload type"); | 2245 "payload type"); |
| 2250 return -1; | 2246 return -1; |
| 2251 } | 2247 } |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3559 int64_t min_rtt = 0; | 3555 int64_t min_rtt = 0; |
| 3560 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3556 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3561 0) { | 3557 0) { |
| 3562 return 0; | 3558 return 0; |
| 3563 } | 3559 } |
| 3564 return rtt; | 3560 return rtt; |
| 3565 } | 3561 } |
| 3566 | 3562 |
| 3567 } // namespace voe | 3563 } // namespace voe |
| 3568 } // namespace webrtc | 3564 } // namespace webrtc |
| OLD | NEW |