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

Side by Side Diff: webrtc/modules/audio_processing/test/audioproc_float.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) 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 <stdio.h> 11 #include <stdio.h>
12 #include <iostream> 12 #include <iostream>
13 #include <sstream> 13 #include <sstream>
14 #include <string> 14 #include <string>
15 #include <utility>
15 16
16 #include "gflags/gflags.h" 17 #include "gflags/gflags.h"
17 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
18 #include "webrtc/base/scoped_ptr.h" 19 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/common_audio/channel_buffer.h" 20 #include "webrtc/common_audio/channel_buffer.h"
20 #include "webrtc/common_audio/wav_file.h" 21 #include "webrtc/common_audio/wav_file.h"
21 #include "webrtc/modules/audio_processing/include/audio_processing.h" 22 #include "webrtc/modules/audio_processing/include/audio_processing.h"
22 #include "webrtc/modules/audio_processing/test/audio_file_processor.h" 23 #include "webrtc/modules/audio_processing/test/audio_file_processor.h"
23 #include "webrtc/modules/audio_processing/test/protobuf_utils.h" 24 #include "webrtc/modules/audio_processing/test/protobuf_utils.h"
24 #include "webrtc/modules/audio_processing/test/test_utils.h" 25 #include "webrtc/modules/audio_processing/test/test_utils.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 116 }
116 ap->set_stream_key_pressed(FLAGS_ts); 117 ap->set_stream_key_pressed(FLAGS_ts);
117 118
118 rtc::scoped_ptr<AudioFileProcessor> processor; 119 rtc::scoped_ptr<AudioFileProcessor> processor;
119 auto out_file = rtc_make_scoped_ptr( 120 auto out_file = rtc_make_scoped_ptr(
120 new WavWriter(FLAGS_o, FLAGS_out_sample_rate, FLAGS_out_channels)); 121 new WavWriter(FLAGS_o, FLAGS_out_sample_rate, FLAGS_out_channels));
121 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl; 122 std::cout << FLAGS_o << ": " << out_file->FormatAsString() << std::endl;
122 if (FLAGS_dump.empty()) { 123 if (FLAGS_dump.empty()) {
123 auto in_file = rtc_make_scoped_ptr(new WavReader(FLAGS_i)); 124 auto in_file = rtc_make_scoped_ptr(new WavReader(FLAGS_i));
124 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl; 125 std::cout << FLAGS_i << ": " << in_file->FormatAsString() << std::endl;
125 processor.reset( 126 processor.reset(new WavFileProcessor(std::move(ap), std::move(in_file),
126 new WavFileProcessor(ap.Pass(), in_file.Pass(), out_file.Pass())); 127 std::move(out_file)));
127 128
128 } else { 129 } else {
129 processor.reset(new AecDumpFileProcessor( 130 processor.reset(new AecDumpFileProcessor(
130 ap.Pass(), fopen(FLAGS_dump.c_str(), "rb"), out_file.Pass())); 131 std::move(ap), fopen(FLAGS_dump.c_str(), "rb"), std::move(out_file)));
131 } 132 }
132 133
133 int num_chunks = 0; 134 int num_chunks = 0;
134 while (processor->ProcessChunk()) { 135 while (processor->ProcessChunk()) {
135 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond); 136 trace_to_stderr.SetTimeSeconds(num_chunks * 1.f / kChunksPerSecond);
136 ++num_chunks; 137 ++num_chunks;
137 } 138 }
138 139
139 if (FLAGS_perf) { 140 if (FLAGS_perf) {
140 const auto& proc_time = processor->proc_time(); 141 const auto& proc_time = processor->proc_time();
141 int64_t exec_time_us = proc_time.sum.Microseconds(); 142 int64_t exec_time_us = proc_time.sum.Microseconds();
142 printf( 143 printf(
143 "\nExecution time: %.3f s, File time: %.2f s\n" 144 "\nExecution time: %.3f s, File time: %.2f s\n"
144 "Time per chunk (mean, max, min):\n%.0f us, %.0f us, %.0f us\n", 145 "Time per chunk (mean, max, min):\n%.0f us, %.0f us, %.0f us\n",
145 exec_time_us * 1e-6, num_chunks * 1.f / kChunksPerSecond, 146 exec_time_us * 1e-6, num_chunks * 1.f / kChunksPerSecond,
146 exec_time_us * 1.f / num_chunks, 1.f * proc_time.max.Microseconds(), 147 exec_time_us * 1.f / num_chunks, 1.f * proc_time.max.Microseconds(),
147 1.f * proc_time.min.Microseconds()); 148 1.f * proc_time.min.Microseconds());
148 } 149 }
149 150
150 return 0; 151 return 0;
151 } 152 }
152 153
153 } // namespace webrtc 154 } // namespace webrtc
154 155
155 int main(int argc, char* argv[]) { 156 int main(int argc, char* argv[]) {
156 return webrtc::main(argc, argv); 157 return webrtc::main(argc, argv);
157 } 158 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/audio_file_processor.cc ('k') | webrtc/modules/audio_processing/test/test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698