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

Unified Diff: webrtc/modules/audio_processing/logging/aec_logging_file_handling.cc

Issue 1272403003: Replaced the wav file dumping functionality in aec_core.c with the newly added corresponding macros (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updates according to comments. Also added BUILD.gn that were previously missing from the changeset Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/logging/aec_logging_file_handling.cc
diff --git a/webrtc/modules/audio_processing/logging/aec_logging_file_handling.cc b/webrtc/modules/audio_processing/logging/aec_logging_file_handling.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0a195448e2dc1c3a22d10ed9de648388f77d6df5
--- /dev/null
+++ b/webrtc/modules/audio_processing/logging/aec_logging_file_handling.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <assert.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "webrtc/common_audio/wav_file.h"
+#include "webrtc/typedefs.h"
+#include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h"
Andrew MacDonald 2015/08/17 16:37:05 nit: style guide likes the associated header to be
peah-webrtc 2015/08/25 05:05:28 Done.
+
+#ifdef WEBRTC_AEC_DEBUG_DUMP
+extern "C" void WebRtcAec_ReopenWav(const char* name,
+ int instance_index,
+ int process_rate,
+ int sample_rate,
+ rtc_WavWriter** wav_file) {
+ int written ATTRIBUTE_UNUSED;
+ char filename[64];
+ if (*wav_file) {
+ if (rtc_WavSampleRate(*wav_file) == sample_rate)
+ return;
+ rtc_WavClose(*wav_file);
+ }
+ written = snprintf(filename, sizeof(filename), "%s%d-%d.wav", name,
+ instance_index, process_rate);
+
+ // Ensrure there was no buffer output error.
+ assert(written >= 0);
Andrew MacDonald 2015/08/17 16:37:05 Since this is C++ now, you could use DCHECKs inste
the sun 2015/08/24 11:04:46 +1
peah-webrtc 2015/08/25 05:05:28 Done.
+ // Ensure that the buffer size was sufficient.
+ assert((size_t)written < sizeof(filename));
+
+ *wav_file = rtc_WavOpen(filename, sample_rate, 1);
+}
+
+extern "C" void WebRtcAec_RawFileOpen(const char* name,
+ int instance_counter,
+ FILE** file) {
+ int written ATTRIBUTE_UNUSED;
+ char filename[64];
+
+ written =
+ snprintf(filename, sizeof(filename), "%s_%d.dat", name, instance_counter);
+
+ // Ensrure there was no buffer output error.
+ assert(written >= 0);
+ // Ensure that the buffer size was sufficient.
+ assert((size_t)written < sizeof(filename));
+
+ *file = fopen(filename, "wb");
+}
+
+#endif // WEBRTC_AEC_DEBUG_DUMP

Powered by Google App Engine
This is Rietveld 408576698