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

Side by Side Diff: webrtc/modules/audio_processing/test/test_utils.cc

Issue 2288593004: Fix Chromium clang plugin warnings (Closed)
Patch Set: 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 18 matching lines...) Expand all
29 fwrite(samples, sizeof(*samples), num_samples, file_handle_); 29 fwrite(samples, sizeof(*samples), num_samples, file_handle_);
30 } 30 }
31 31
32 void RawFile::WriteSamples(const float* samples, size_t num_samples) { 32 void RawFile::WriteSamples(const float* samples, size_t num_samples) {
33 fwrite(samples, sizeof(*samples), num_samples, file_handle_); 33 fwrite(samples, sizeof(*samples), num_samples, file_handle_);
34 } 34 }
35 35
36 ChannelBufferWavReader::ChannelBufferWavReader(std::unique_ptr<WavReader> file) 36 ChannelBufferWavReader::ChannelBufferWavReader(std::unique_ptr<WavReader> file)
37 : file_(std::move(file)) {} 37 : file_(std::move(file)) {}
38 38
39 ChannelBufferWavReader::~ChannelBufferWavReader() = default;
40
39 bool ChannelBufferWavReader::Read(ChannelBuffer<float>* buffer) { 41 bool ChannelBufferWavReader::Read(ChannelBuffer<float>* buffer) {
40 RTC_CHECK_EQ(file_->num_channels(), buffer->num_channels()); 42 RTC_CHECK_EQ(file_->num_channels(), buffer->num_channels());
41 interleaved_.resize(buffer->size()); 43 interleaved_.resize(buffer->size());
42 if (file_->ReadSamples(interleaved_.size(), &interleaved_[0]) != 44 if (file_->ReadSamples(interleaved_.size(), &interleaved_[0]) !=
43 interleaved_.size()) { 45 interleaved_.size()) {
44 return false; 46 return false;
45 } 47 }
46 48
47 FloatS16ToFloat(&interleaved_[0], interleaved_.size(), &interleaved_[0]); 49 FloatS16ToFloat(&interleaved_[0], interleaved_.size(), &interleaved_[0]);
48 Deinterleave(&interleaved_[0], buffer->num_frames(), buffer->num_channels(), 50 Deinterleave(&interleaved_[0], buffer->num_frames(), buffer->num_channels(),
49 buffer->channels()); 51 buffer->channels());
50 return true; 52 return true;
51 } 53 }
52 54
53 ChannelBufferWavWriter::ChannelBufferWavWriter(std::unique_ptr<WavWriter> file) 55 ChannelBufferWavWriter::ChannelBufferWavWriter(std::unique_ptr<WavWriter> file)
54 : file_(std::move(file)) {} 56 : file_(std::move(file)) {}
55 57
58 ChannelBufferWavWriter::~ChannelBufferWavWriter() = default;
59
56 void ChannelBufferWavWriter::Write(const ChannelBuffer<float>& buffer) { 60 void ChannelBufferWavWriter::Write(const ChannelBuffer<float>& buffer) {
57 RTC_CHECK_EQ(file_->num_channels(), buffer.num_channels()); 61 RTC_CHECK_EQ(file_->num_channels(), buffer.num_channels());
58 interleaved_.resize(buffer.size()); 62 interleaved_.resize(buffer.size());
59 Interleave(buffer.channels(), buffer.num_frames(), buffer.num_channels(), 63 Interleave(buffer.channels(), buffer.num_frames(), buffer.num_channels(),
60 &interleaved_[0]); 64 &interleaved_[0]);
61 FloatToFloatS16(&interleaved_[0], interleaved_.size(), &interleaved_[0]); 65 FloatToFloatS16(&interleaved_[0], interleaved_.size(), &interleaved_[0]);
62 file_->WriteSamples(&interleaved_[0], interleaved_.size()); 66 file_->WriteSamples(&interleaved_[0], interleaved_.size());
63 } 67 }
64 68
65 void WriteIntData(const int16_t* data, 69 void WriteIntData(const int16_t* data,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 149
146 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions, 150 std::vector<Point> ParseArrayGeometry(const std::string& mic_positions,
147 size_t num_mics) { 151 size_t num_mics) {
148 std::vector<Point> result = ParseArrayGeometry(mic_positions); 152 std::vector<Point> result = ParseArrayGeometry(mic_positions);
149 RTC_CHECK_EQ(result.size(), num_mics) 153 RTC_CHECK_EQ(result.size(), num_mics)
150 << "Could not parse mic_positions or incorrect number of points."; 154 << "Could not parse mic_positions or incorrect number of points.";
151 return result; 155 return result;
152 } 156 }
153 157
154 } // namespace webrtc 158 } // namespace webrtc
OLDNEW
« webrtc/common.h ('K') | « webrtc/modules/audio_processing/test/test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698