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

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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/tools/resample_input_audio_file.h" 11 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h"
12 12
13 #include "webrtc/base/checks.h" 13 #include "webrtc/base/checks.h"
14 #include "webrtc/base/scoped_ptr.h" 14 #include "webrtc/base/scoped_ptr.h"
15 15
16 namespace webrtc { 16 namespace webrtc {
17 namespace test { 17 namespace test {
18 18
19 bool ResampleInputAudioFile::Read(size_t samples, 19 bool ResampleInputAudioFile::Read(size_t samples,
20 int output_rate_hz, 20 int output_rate_hz,
21 int16_t* destination) { 21 int16_t* destination) {
22 const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz; 22 const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz;
23 CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_) 23 RTC_CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_)
24 << "Frame size and sample rates don't add up to an integer."; 24 << "Frame size and sample rates don't add up to an integer.";
25 rtc::scoped_ptr<int16_t[]> temp_destination(new int16_t[samples_to_read]); 25 rtc::scoped_ptr<int16_t[]> temp_destination(new int16_t[samples_to_read]);
26 if (!InputAudioFile::Read(samples_to_read, temp_destination.get())) 26 if (!InputAudioFile::Read(samples_to_read, temp_destination.get()))
27 return false; 27 return false;
28 resampler_.ResetIfNeeded(file_rate_hz_, output_rate_hz, 1); 28 resampler_.ResetIfNeeded(file_rate_hz_, output_rate_hz, 1);
29 size_t output_length = 0; 29 size_t output_length = 0;
30 CHECK_EQ(resampler_.Push(temp_destination.get(), samples_to_read, destination, 30 RTC_CHECK_EQ(resampler_.Push(temp_destination.get(), samples_to_read,
31 samples, output_length), 31 destination, samples, output_length),
32 0); 32 0);
33 CHECK_EQ(samples, output_length); 33 RTC_CHECK_EQ(samples, output_length);
34 return true; 34 return true;
35 } 35 }
36 36
37 bool ResampleInputAudioFile::Read(size_t samples, int16_t* destination) { 37 bool ResampleInputAudioFile::Read(size_t samples, int16_t* destination) {
38 CHECK_GT(output_rate_hz_, 0) << "Output rate not set."; 38 RTC_CHECK_GT(output_rate_hz_, 0) << "Output rate not set.";
39 return Read(samples, output_rate_hz_, destination); 39 return Read(samples, output_rate_hz_, destination);
40 } 40 }
41 41
42 void ResampleInputAudioFile::set_output_rate_hz(int rate_hz) { 42 void ResampleInputAudioFile::set_output_rate_hz(int rate_hz) {
43 output_rate_hz_ = rate_hz; 43 output_rate_hz_ = rate_hz;
44 } 44 }
45 45
46 } // namespace test 46 } // namespace test
47 } // namespace webrtc 47 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698