Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: webrtc/voice_engine/dtmf_inband_queue.cc

Issue 1722253002: - Clean up unused voice engine DTMF code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@voe_dtmf_1
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/voice_engine/dtmf_inband_queue.h ('k') | webrtc/voice_engine/transmit_mixer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/system_wrappers/include/trace.h"
12 #include "webrtc/voice_engine/dtmf_inband_queue.h"
13
14 namespace webrtc {
15
16 DtmfInbandQueue::DtmfInbandQueue(int32_t id):
17 _id(id),
18 _nextEmptyIndex(0)
19 {
20 memset(_DtmfKey,0, sizeof(_DtmfKey));
21 memset(_DtmfLen,0, sizeof(_DtmfLen));
22 memset(_DtmfLevel,0, sizeof(_DtmfLevel));
23 }
24
25 DtmfInbandQueue::~DtmfInbandQueue()
26 {
27 }
28
29 int
30 DtmfInbandQueue::AddDtmf(uint8_t key, uint16_t len, uint8_t level)
31 {
32 rtc::CritScope lock(&_DtmfCritsect);
33
34 if (_nextEmptyIndex >= kDtmfInbandMax)
35 {
36 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_id,-1),
37 "DtmfInbandQueue::AddDtmf() unable to add Dtmf tone");
38 return -1;
39 }
40 int32_t index = _nextEmptyIndex;
41 _DtmfKey[index] = key;
42 _DtmfLen[index] = len;
43 _DtmfLevel[index] = level;
44 _nextEmptyIndex++;
45 return 0;
46 }
47
48 int8_t
49 DtmfInbandQueue::NextDtmf(uint16_t* len, uint8_t* level)
50 {
51 rtc::CritScope lock(&_DtmfCritsect);
52
53 if(!PendingDtmf())
54 {
55 return -1;
56 }
57 int8_t nextDtmf = _DtmfKey[0];
58 *len=_DtmfLen[0];
59 *level=_DtmfLevel[0];
60
61 memmove(&(_DtmfKey[0]), &(_DtmfKey[1]),
62 _nextEmptyIndex*sizeof(uint8_t));
63 memmove(&(_DtmfLen[0]), &(_DtmfLen[1]),
64 _nextEmptyIndex*sizeof(uint16_t));
65 memmove(&(_DtmfLevel[0]), &(_DtmfLevel[1]),
66 _nextEmptyIndex*sizeof(uint8_t));
67
68 _nextEmptyIndex--;
69 return nextDtmf;
70 }
71
72 bool
73 DtmfInbandQueue::PendingDtmf()
74 {
75 rtc::CritScope lock(&_DtmfCritsect);
76 return _nextEmptyIndex > 0;
77 }
78
79 void
80 DtmfInbandQueue::ResetDtmf()
81 {
82 rtc::CritScope lock(&_DtmfCritsect);
83 _nextEmptyIndex = 0;
84 }
85
86 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/dtmf_inband_queue.h ('k') | webrtc/voice_engine/transmit_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698