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

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

Issue 1460043002: Don't call the Pass methods of rtc::Buffer, rtc::scoped_ptr, and rtc::ScopedVector (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Restore the Pass methods Created 5 years 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
11 #include "webrtc/modules/audio_processing/test/audio_file_processor.h" 11 #include "webrtc/modules/audio_processing/test/audio_file_processor.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility>
14 15
15 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
16 #include "webrtc/modules/audio_processing/test/protobuf_utils.h" 17 #include "webrtc/modules/audio_processing/test/protobuf_utils.h"
17 18
18 using rtc::scoped_ptr; 19 using rtc::scoped_ptr;
19 using rtc::CheckedDivExact; 20 using rtc::CheckedDivExact;
20 using std::vector; 21 using std::vector;
21 using webrtc::audioproc::Event; 22 using webrtc::audioproc::Event;
22 using webrtc::audioproc::Init; 23 using webrtc::audioproc::Init;
23 using webrtc::audioproc::ReverseStream; 24 using webrtc::audioproc::ReverseStream;
(...skipping 12 matching lines...) Expand all
36 return ChannelBuffer<float>( 37 return ChannelBuffer<float>(
37 CheckedDivExact(file.sample_rate(), AudioFileProcessor::kChunksPerSecond), 38 CheckedDivExact(file.sample_rate(), AudioFileProcessor::kChunksPerSecond),
38 file.num_channels()); 39 file.num_channels());
39 } 40 }
40 41
41 } // namespace 42 } // namespace
42 43
43 WavFileProcessor::WavFileProcessor(scoped_ptr<AudioProcessing> ap, 44 WavFileProcessor::WavFileProcessor(scoped_ptr<AudioProcessing> ap,
44 scoped_ptr<WavReader> in_file, 45 scoped_ptr<WavReader> in_file,
45 scoped_ptr<WavWriter> out_file) 46 scoped_ptr<WavWriter> out_file)
46 : ap_(ap.Pass()), 47 : ap_(std::move(ap)),
47 in_buf_(GetChannelBuffer(*in_file)), 48 in_buf_(GetChannelBuffer(*in_file)),
48 out_buf_(GetChannelBuffer(*out_file)), 49 out_buf_(GetChannelBuffer(*out_file)),
49 input_config_(GetStreamConfig(*in_file)), 50 input_config_(GetStreamConfig(*in_file)),
50 output_config_(GetStreamConfig(*out_file)), 51 output_config_(GetStreamConfig(*out_file)),
51 buffer_reader_(in_file.Pass()), 52 buffer_reader_(std::move(in_file)),
52 buffer_writer_(out_file.Pass()) {} 53 buffer_writer_(std::move(out_file)) {}
53 54
54 bool WavFileProcessor::ProcessChunk() { 55 bool WavFileProcessor::ProcessChunk() {
55 if (!buffer_reader_.Read(&in_buf_)) { 56 if (!buffer_reader_.Read(&in_buf_)) {
56 return false; 57 return false;
57 } 58 }
58 { 59 {
59 const auto st = ScopedTimer(mutable_proc_time()); 60 const auto st = ScopedTimer(mutable_proc_time());
60 RTC_CHECK_EQ(kNoErr, 61 RTC_CHECK_EQ(kNoErr,
61 ap_->ProcessStream(in_buf_.channels(), input_config_, 62 ap_->ProcessStream(in_buf_.channels(), input_config_,
62 output_config_, out_buf_.channels())); 63 output_config_, out_buf_.channels()));
63 } 64 }
64 buffer_writer_.Write(out_buf_); 65 buffer_writer_.Write(out_buf_);
65 return true; 66 return true;
66 } 67 }
67 68
68 AecDumpFileProcessor::AecDumpFileProcessor(scoped_ptr<AudioProcessing> ap, 69 AecDumpFileProcessor::AecDumpFileProcessor(scoped_ptr<AudioProcessing> ap,
69 FILE* dump_file, 70 FILE* dump_file,
70 scoped_ptr<WavWriter> out_file) 71 scoped_ptr<WavWriter> out_file)
71 : ap_(ap.Pass()), 72 : ap_(std::move(ap)),
72 dump_file_(dump_file), 73 dump_file_(dump_file),
73 out_buf_(GetChannelBuffer(*out_file)), 74 out_buf_(GetChannelBuffer(*out_file)),
74 output_config_(GetStreamConfig(*out_file)), 75 output_config_(GetStreamConfig(*out_file)),
75 buffer_writer_(out_file.Pass()) { 76 buffer_writer_(std::move(out_file)) {
76 RTC_CHECK(dump_file_) << "Could not open dump file for reading."; 77 RTC_CHECK(dump_file_) << "Could not open dump file for reading.";
77 } 78 }
78 79
79 AecDumpFileProcessor::~AecDumpFileProcessor() { 80 AecDumpFileProcessor::~AecDumpFileProcessor() {
80 fclose(dump_file_); 81 fclose(dump_file_);
81 } 82 }
82 83
83 bool AecDumpFileProcessor::ProcessChunk() { 84 bool AecDumpFileProcessor::ProcessChunk() {
84 Event event_msg; 85 Event event_msg;
85 86
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 const auto st = ScopedTimer(mutable_proc_time()); 169 const auto st = ScopedTimer(mutable_proc_time());
169 // TODO(ajm): This currently discards the processed output, which is needed 170 // TODO(ajm): This currently discards the processed output, which is needed
170 // for e.g. intelligibility enhancement. 171 // for e.g. intelligibility enhancement.
171 RTC_CHECK_EQ(kNoErr, ap_->ProcessReverseStream( 172 RTC_CHECK_EQ(kNoErr, ap_->ProcessReverseStream(
172 reverse_buf_->channels(), reverse_config_, 173 reverse_buf_->channels(), reverse_config_,
173 reverse_config_, reverse_buf_->channels())); 174 reverse_config_, reverse_buf_->channels()));
174 } 175 }
175 } 176 }
176 177
177 } // namespace webrtc 178 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/audio_track_jni.cc ('k') | webrtc/modules/audio_processing/test/audioproc_float.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698