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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/dtmf_queue.cc

Issue 2365873002: Make RtpSenderAudio not inherit from DtmfQueue (Closed)
Patch Set: Make RtpSenderAudio not inherit from DtmfQueue Created 4 years, 3 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
OLDNEW
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
11 #include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h" 11 #include "webrtc/modules/rtp_rtcp/source/dtmf_queue.h"
12 12
13 #include <string.h> 13 #include <string.h>
14 14
15 namespace webrtc { 15 namespace webrtc {
16 DTMFqueue::DTMFqueue() : next_empty_index_(0) { 16 DTMFqueue::DTMFqueue() : next_empty_index_(0) {
17 memset(dtmf_key_, 0, sizeof(dtmf_key_)); 17 memset(dtmf_key_, 0, sizeof(dtmf_key_));
18 memset(dtmf_length, 0, sizeof(dtmf_length)); 18 memset(dtmf_length, 0, sizeof(dtmf_length));
19 memset(dtmf_level_, 0, sizeof(dtmf_level_)); 19 memset(dtmf_level_, 0, sizeof(dtmf_level_));
20 } 20 }
21 21
22 DTMFqueue::~DTMFqueue() {}
23
24 int32_t DTMFqueue::AddDTMF(uint8_t key, uint16_t len, uint8_t level) { 22 int32_t DTMFqueue::AddDTMF(uint8_t key, uint16_t len, uint8_t level) {
25 rtc::CritScope lock(&dtmf_critsect_); 23 rtc::CritScope lock(&dtmf_critsect_);
26 24
27 if (next_empty_index_ >= DTMF_OUTBAND_MAX) { 25 if (next_empty_index_ >= DTMF_OUTBAND_MAX) {
28 return -1; 26 return -1;
29 } 27 }
30 int32_t index = next_empty_index_; 28 int32_t index = next_empty_index_;
31 dtmf_key_[index] = key; 29 dtmf_key_[index] = key;
32 dtmf_length[index] = len; 30 dtmf_length[index] = len;
33 dtmf_level_[index] = level; 31 dtmf_level_[index] = level;
(...skipping 18 matching lines...) Expand all
52 next_empty_index_ * sizeof(uint8_t)); 50 next_empty_index_ * sizeof(uint8_t));
53 51
54 next_empty_index_--; 52 next_empty_index_--;
55 return 0; 53 return 0;
56 } 54 }
57 55
58 bool DTMFqueue::PendingDTMF() { 56 bool DTMFqueue::PendingDTMF() {
59 rtc::CritScope lock(&dtmf_critsect_); 57 rtc::CritScope lock(&dtmf_critsect_);
60 return next_empty_index_ > 0; 58 return next_empty_index_ > 0;
61 } 59 }
62
63 void DTMFqueue::ResetDTMF() {
64 rtc::CritScope lock(&dtmf_critsect_);
65 next_empty_index_ = 0;
66 }
67 } // namespace webrtc 60 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698