OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 "MPA", "G728", "G729" }; | 272 "MPA", "G728", "G729" }; |
273 | 273 |
274 for (int n = 0; n < NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE; n++) { | 274 for (int n = 0; n < NUM_CODECS_WITH_FIXED_PAYLOAD_TYPE; n++) { |
275 if (!STR_CASE_CMP(payloadName, fixPayloadTypeCodecs[n])) { | 275 if (!STR_CASE_CMP(payloadName, fixPayloadTypeCodecs[n])) { |
276 return true; | 276 return true; |
277 } | 277 } |
278 } | 278 } |
279 return false; | 279 return false; |
280 } | 280 } |
281 | 281 |
282 DTMFDetector::DTMFDetector() { | |
283 for (int16_t n = 0; n < 1000; n++) { | |
284 _toneCntr[n] = 0; | |
285 } | |
286 } | |
287 | |
288 DTMFDetector::~DTMFDetector() { | |
289 } | |
290 | |
291 int32_t DTMFDetector::IncomingDtmf(const uint8_t digitDtmf, | |
292 const bool /* toneEnded */) { | |
293 fprintf(stdout, "%d-", digitDtmf); | |
294 _toneCntr[digitDtmf]++; | |
295 return 0; | |
296 } | |
297 | |
298 void DTMFDetector::PrintDetectedDigits() { | |
299 for (int16_t n = 0; n < 1000; n++) { | |
300 if (_toneCntr[n] > 0) { | |
301 fprintf(stdout, "%d %u msec, \n", n, _toneCntr[n] * 10); | |
302 } | |
303 } | |
304 fprintf(stdout, "\n"); | |
305 return; | |
306 } | |
307 | |
308 void VADCallback::Reset() { | 282 void VADCallback::Reset() { |
309 memset(_numFrameTypes, 0, sizeof(_numFrameTypes)); | 283 memset(_numFrameTypes, 0, sizeof(_numFrameTypes)); |
310 } | 284 } |
311 | 285 |
312 VADCallback::VADCallback() { | 286 VADCallback::VADCallback() { |
313 memset(_numFrameTypes, 0, sizeof(_numFrameTypes)); | 287 memset(_numFrameTypes, 0, sizeof(_numFrameTypes)); |
314 } | 288 } |
315 | 289 |
316 void VADCallback::PrintFrameTypes() { | 290 void VADCallback::PrintFrameTypes() { |
317 printf("kFrameEmpty......... %d\n", _numFrameTypes[kFrameEmpty]); | 291 printf("kFrameEmpty......... %d\n", _numFrameTypes[kFrameEmpty]); |
318 printf("kAudioFrameSpeech... %d\n", _numFrameTypes[kAudioFrameSpeech]); | 292 printf("kAudioFrameSpeech... %d\n", _numFrameTypes[kAudioFrameSpeech]); |
319 printf("kAudioFrameCN....... %d\n", _numFrameTypes[kAudioFrameCN]); | 293 printf("kAudioFrameCN....... %d\n", _numFrameTypes[kAudioFrameCN]); |
320 printf("kVideoFrameKey...... %d\n", _numFrameTypes[kVideoFrameKey]); | 294 printf("kVideoFrameKey...... %d\n", _numFrameTypes[kVideoFrameKey]); |
321 printf("kVideoFrameDelta.... %d\n", _numFrameTypes[kVideoFrameDelta]); | 295 printf("kVideoFrameDelta.... %d\n", _numFrameTypes[kVideoFrameDelta]); |
322 } | 296 } |
323 | 297 |
324 int32_t VADCallback::InFrameType(FrameType frame_type) { | 298 int32_t VADCallback::InFrameType(FrameType frame_type) { |
325 _numFrameTypes[frame_type]++; | 299 _numFrameTypes[frame_type]++; |
326 return 0; | 300 return 0; |
327 } | 301 } |
328 | 302 |
329 } // namespace webrtc | 303 } // namespace webrtc |
OLD | NEW |