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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 } | 201 } |
202 } | 202 } |
203 if (dtmfToneStarted) { | 203 if (dtmfToneStarted) { |
204 if (_audioFeedback) | 204 if (_audioFeedback) |
205 _audioFeedback->OnPlayTelephoneEvent(key, dtmfLengthMS, _dtmfLevel); | 205 _audioFeedback->OnPlayTelephoneEvent(key, dtmfLengthMS, _dtmfLevel); |
206 } | 206 } |
207 | 207 |
208 // A source MAY send events and coded audio packets for the same time | 208 // A source MAY send events and coded audio packets for the same time |
209 // but we don't support it | 209 // but we don't support it |
210 if (_dtmfEventIsOn) { | 210 if (_dtmfEventIsOn) { |
211 if (frameType == kFrameEmpty) { | 211 if (frameType == kEmptyFrame) { |
212 // kFrameEmpty is used to drive the DTMF when in CN mode | 212 // kEmptyFrame is used to drive the DTMF when in CN mode |
213 // it can be triggered more frequently than we want to send the | 213 // it can be triggered more frequently than we want to send the |
214 // DTMF packets. | 214 // DTMF packets. |
215 if (packet_size_samples > (captureTimeStamp - _dtmfTimestampLastSent)) { | 215 if (packet_size_samples > (captureTimeStamp - _dtmfTimestampLastSent)) { |
216 // not time to send yet | 216 // not time to send yet |
217 return 0; | 217 return 0; |
218 } | 218 } |
219 } | 219 } |
220 _dtmfTimestampLastSent = captureTimeStamp; | 220 _dtmfTimestampLastSent = captureTimeStamp; |
221 uint32_t dtmfDurationSamples = captureTimeStamp - _dtmfTimestamp; | 221 uint32_t dtmfDurationSamples = captureTimeStamp - _dtmfTimestamp; |
222 bool ended = false; | 222 bool ended = false; |
(...skipping 29 matching lines...) Expand all Loading... |
252 !_dtmfEventFirstPacketSent) != 0) { | 252 !_dtmfEventFirstPacketSent) != 0) { |
253 return -1; | 253 return -1; |
254 } | 254 } |
255 _dtmfEventFirstPacketSent = true; | 255 _dtmfEventFirstPacketSent = true; |
256 return 0; | 256 return 0; |
257 } | 257 } |
258 } | 258 } |
259 return 0; | 259 return 0; |
260 } | 260 } |
261 if (payloadSize == 0 || payloadData == NULL) { | 261 if (payloadSize == 0 || payloadData == NULL) { |
262 if (frameType == kFrameEmpty) { | 262 if (frameType == kEmptyFrame) { |
263 // we don't send empty audio RTP packets | 263 // we don't send empty audio RTP packets |
264 // no error since we use it to drive DTMF when we use VAD | 264 // no error since we use it to drive DTMF when we use VAD |
265 return 0; | 265 return 0; |
266 } | 266 } |
267 return -1; | 267 return -1; |
268 } | 268 } |
269 uint8_t dataBuffer[IP_PACKET_SIZE]; | 269 uint8_t dataBuffer[IP_PACKET_SIZE]; |
270 bool markerBit = MarkerBit(frameType, payloadType); | 270 bool markerBit = MarkerBit(frameType, payloadType); |
271 | 271 |
272 int32_t rtpHeaderLength = 0; | 272 int32_t rtpHeaderLength = 0; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1, | 479 retVal = _rtpSender->SendToNetwork(dtmfbuffer, 4, 12, -1, |
480 kAllowRetransmission, | 480 kAllowRetransmission, |
481 RtpPacketSender::kHighPriority); | 481 RtpPacketSender::kHighPriority); |
482 sendCount--; | 482 sendCount--; |
483 | 483 |
484 }while (sendCount > 0 && retVal == 0); | 484 }while (sendCount > 0 && retVal == 0); |
485 | 485 |
486 return retVal; | 486 return retVal; |
487 } | 487 } |
488 } // namespace webrtc | 488 } // namespace webrtc |
OLD | NEW |