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

Side by Side Diff: webrtc/modules/audio_processing/logging/apm_data_dumper.cc

Issue 1877713002: Replaced the data logging functionality in the AEC with a generic logging functionality (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes in response to latest reviewer comments Created 4 years, 7 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
« no previous file with comments | « webrtc/modules/audio_processing/logging/apm_data_dumper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
12
13 #include <sstream>
14
15 #include "webrtc/base/stringutils.h"
16
17 // Check to verify that the define is properly set.
18 #if !defined(WEBRTC_AEC_DEBUG_DUMP) || \
19 (WEBRTC_AEC_DEBUG_DUMP != 0 && WEBRTC_AEC_DEBUG_DUMP != 1)
20 #error "Set WEBRTC_AEC_DEBUG_DUMP to either 0 or 1"
21 #endif
22
23 namespace webrtc {
24
25 namespace {
26
27 #if WEBRTC_AEC_DEBUG_DUMP == 1
28 std::string FormFileName(const char* name,
29 int instance_index,
30 int reinit_index,
31 const std::string& suffix) {
32 std::stringstream ss;
33 ss << name << "_" << instance_index << "-" << reinit_index << suffix;
34 return ss.str();
35 }
36 #endif
37
38 } // namespace
39
40 #if WEBRTC_AEC_DEBUG_DUMP == 1
41 FILE* ApmDataDumper::GetRawFile(const char* name) {
42 std::string filename =
43 FormFileName(name, instance_index_, recording_set_index_, ".dat");
44 auto search = raw_files_.find(filename);
45 if (search == raw_files_.end()) {
46 raw_files_[filename].reset(fopen(filename.c_str(), "wb"));
47 }
48 return raw_files_[filename].get();
kwiberg-webrtc 2016/05/03 09:02:50 You do 2-3 map lookups here. Try something like
peah-webrtc 2016/05/03 11:24:40 Awesome suggestion! Yes, they are all non-null. Do
49 }
50
51 WavWriter* ApmDataDumper::GetWavFile(const char* name,
52 int sample_rate_hz,
53 int num_channels) {
54 std::string filename =
55 FormFileName(name, instance_index_, recording_set_index_, ".wav");
56 auto search = wav_files_.find(filename);
57 if (search == wav_files_.end()) {
58 wav_files_[filename].reset(
59 new WavWriter(filename.c_str(), sample_rate_hz, num_channels));
60 }
61 return wav_files_[filename].get();
kwiberg-webrtc 2016/05/03 09:02:50 Same here.
peah-webrtc 2016/05/03 11:24:40 Done.
62 }
63
64 #endif
65
66 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/logging/apm_data_dumper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698