OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 21 matching lines...) Expand all Loading... |
32 // | * | 10 | tone | yes | | 32 // | * | 10 | tone | yes | |
33 // | # | 11 | tone | yes | | 33 // | # | 11 | tone | yes | |
34 // | A--D | 12--15 | tone | yes | | 34 // | A--D | 12--15 | tone | yes | |
35 // +-------+--------+------+---------+ | 35 // +-------+--------+------+---------+ |
36 // The "," is a special event defined by the WebRTC spec. It means to delay for | 36 // The "," is a special event defined by the WebRTC spec. It means to delay for |
37 // 2 seconds before processing the next tone. We use -1 as its code. | 37 // 2 seconds before processing the next tone. We use -1 as its code. |
38 static const int kDtmfCodeTwoSecondDelay = -1; | 38 static const int kDtmfCodeTwoSecondDelay = -1; |
39 static const int kDtmfTwoSecondInMs = 2000; | 39 static const int kDtmfTwoSecondInMs = 2000; |
40 static const char kDtmfValidTones[] = ",0123456789*#ABCDabcd"; | 40 static const char kDtmfValidTones[] = ",0123456789*#ABCDabcd"; |
41 static const char kDtmfTonesTable[] = ",0123456789*#ABCD"; | 41 static const char kDtmfTonesTable[] = ",0123456789*#ABCD"; |
42 // The duration cannot be more than 6000ms or less than 70ms. The gap between | 42 // The duration cannot be more than 6000ms or less than 40ms. The gap between |
43 // tones must be at least 50 ms. | 43 // tones must be at least 50 ms. |
44 static const int kDtmfDefaultDurationMs = 100; | 44 static const int kDtmfDefaultDurationMs = 100; |
45 static const int kDtmfMinDurationMs = 70; | 45 static const int kDtmfMinDurationMs = 40; |
46 static const int kDtmfMaxDurationMs = 6000; | 46 static const int kDtmfMaxDurationMs = 6000; |
47 static const int kDtmfDefaultGapMs = 50; | 47 static const int kDtmfDefaultGapMs = 50; |
48 static const int kDtmfMinGapMs = 50; | 48 static const int kDtmfMinGapMs = 50; |
49 | 49 |
50 // Get DTMF code from the DTMF event character. | 50 // Get DTMF code from the DTMF event character. |
51 bool GetDtmfCode(char tone, int* code) { | 51 bool GetDtmfCode(char tone, int* code) { |
52 // Convert a-d to A-D. | 52 // Convert a-d to A-D. |
53 char event = toupper(tone); | 53 char event = toupper(tone); |
54 const char* p = strchr(kDtmfTonesTable, event); | 54 const char* p = strchr(kDtmfTonesTable, event); |
55 if (!p) { | 55 if (!p) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 LOG(LS_INFO) << "The Dtmf provider is deleted. Clear the sending queue."; | 230 LOG(LS_INFO) << "The Dtmf provider is deleted. Clear the sending queue."; |
231 StopSending(); | 231 StopSending(); |
232 provider_ = NULL; | 232 provider_ = NULL; |
233 } | 233 } |
234 | 234 |
235 void DtmfSender::StopSending() { | 235 void DtmfSender::StopSending() { |
236 signaling_thread_->Clear(this); | 236 signaling_thread_->Clear(this); |
237 } | 237 } |
238 | 238 |
239 } // namespace webrtc | 239 } // namespace webrtc |
OLD | NEW |