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

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

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: Code update according to reviewer comments 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.c
diff --git a/webrtc/modules/audio_processing/logging/aec_logging_file_handling.c b/webrtc/modules/audio_processing/logging/aec_logging_file_handling.c
new file mode 100644
index 0000000000000000000000000000000000000000..916ea5cb36de838e90f32033dd9840d9f37b411b
--- /dev/null
+++ b/webrtc/modules/audio_processing/logging/aec_logging_file_handling.c
@@ -0,0 +1,55 @@
+/*
+ * 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"
+
+#ifdef WEBRTC_AEC_DEBUG_DUMP
+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);
+ assert(written >= 0); // no output error
+ assert((size_t)written < sizeof(filename)); // buffer was large enough
+ *wav_file = rtc_WavOpen(filename, sample_rate, 1);
+}
+
+
+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);
+ assert(written >= 0); // no output error
+ assert((size_t)written < sizeof(filename)); // buffer was large enough
+
+ *file = fopen(filename, "wb");
+}
+
+
+#endif // WEBRTC_AEC_DEBUG_DUMP

Powered by Google App Engine
This is Rietveld 408576698