From de0fc58784f3f27503eef37ae7f50cae0bcbe30c Mon Sep 17 00:00:00 2001 From: peah Date: Wed, 2 Dec 2015 08:20:53 -0800 Subject: [PATCH] Adding two more debug macros for logging scalar values to file. The two added macros simplifies the logging code when a value which is not stored in a variable should be logged. BUG= Review URL: https://codereview.webrtc.org/1488613002 Cr-Commit-Position: refs/heads/master@{#10870} --- .../audio_processing/logging/aec_logging.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/webrtc/modules/audio_processing/logging/aec_logging.h b/webrtc/modules/audio_processing/logging/aec_logging.h index 3cf9ff89ed..b062913be2 100644 --- a/webrtc/modules/audio_processing/logging/aec_logging.h +++ b/webrtc/modules/audio_processing/logging/aec_logging.h @@ -43,6 +43,20 @@ (void) fwrite(data, data_size, 1, file); \ } while (0) +// Dumps a raw scalar int32 to file. +#define RTC_AEC_DEBUG_RAW_WRITE_SCALAR_INT32(file, data) \ + do { \ + int32_t value_to_store = data; \ + (void) fwrite(&value_to_store, sizeof(value_to_store), 1, file); \ + } while (0) + +// Dumps a raw scalar double to file. +#define RTC_AEC_DEBUG_RAW_WRITE_SCALAR_DOUBLE(file, data) \ + do { \ + double value_to_store = data; \ + (void) fwrite(&value_to_store, sizeof(value_to_store), 1, file); \ + } while (0) + // Opens a raw data file for writing using the specified sample rate. #define RTC_AEC_DEBUG_RAW_OPEN(name, instance_counter, file) \ do { \ @@ -73,6 +87,14 @@ do { \ } while (0) +#define RTC_AEC_DEBUG_RAW_WRITE_SCALAR_INT32(file, data) \ + do { \ + } while (0) + +#define RTC_AEC_DEBUG_RAW_WRITE_SCALAR_DOUBLE(file, data) \ + do { \ + } while (0) + #define RTC_AEC_DEBUG_RAW_OPEN(file, name, instance_counter) \ do { \ } while (0)