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 |
11 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h" | 11 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h" |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 #include <algorithm> // max | 14 #include <algorithm> // max |
15 | 15 |
16 #include "webrtc/rtc_base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/rtc_base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 | 18 |
19 // Modify the code to obtain backwards bit-exactness. Once bit-exactness is no | 19 // Modify the code to obtain backwards bit-exactness. Once bit-exactness is no |
20 // longer required, this #define should be removed (and the code that it | 20 // longer required, this #define should be removed (and the code that it |
21 // enables). | 21 // enables). |
22 #define LEGACY_BITEXACT | 22 #define LEGACY_BITEXACT |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 | 25 |
26 DtmfBuffer::DtmfBuffer(int fs_hz) { | 26 DtmfBuffer::DtmfBuffer(int fs_hz) { |
27 SetSampleRate(fs_hz); | 27 SetSampleRate(fs_hz); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // that belong to the same events, and therefore sharing the same start | 239 // that belong to the same events, and therefore sharing the same start |
240 // timestamp, have already been merged before the sort method is called. | 240 // timestamp, have already been merged before the sort method is called. |
241 bool DtmfBuffer::CompareEvents(const DtmfEvent& a, const DtmfEvent& b) { | 241 bool DtmfBuffer::CompareEvents(const DtmfEvent& a, const DtmfEvent& b) { |
242 if (a.timestamp == b.timestamp) { | 242 if (a.timestamp == b.timestamp) { |
243 return a.event_no < b.event_no; | 243 return a.event_no < b.event_no; |
244 } | 244 } |
245 // Take wrap-around into account. | 245 // Take wrap-around into account. |
246 return (static_cast<uint32_t>(b.timestamp - a.timestamp) < 0xFFFFFFFF / 2); | 246 return (static_cast<uint32_t>(b.timestamp - a.timestamp) < 0xFFFFFFFF / 2); |
247 } | 247 } |
248 } // namespace webrtc | 248 } // namespace webrtc |
OLD | NEW |