aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/audio_processing/logging/aec_logging.h
blob: 3cf9ff89edc34f0bc674404e267c00188d44b247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 *  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.
 */

#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_

#include <stdio.h>

#include "webrtc/modules/audio_processing/logging/aec_logging_file_handling.h"

// To enable AEC logging, invoke GYP with -Daec_debug_dump=1.
#ifdef WEBRTC_AEC_DEBUG_DUMP
// Dumps a wav data to file.
#define RTC_AEC_DEBUG_WAV_WRITE(file, data, num_samples) \
  do {                                                   \
    rtc_WavWriteSamples(file, data, num_samples);        \
  } while (0)

// (Re)opens a wav file for writing using the specified sample rate.
#define RTC_AEC_DEBUG_WAV_REOPEN(name, instance_index, process_rate,     \
                                 sample_rate, wav_file)                  \
  do {                                                                   \
    WebRtcAec_ReopenWav(name, instance_index, process_rate, sample_rate, \
                        wav_file);                                       \
  } while (0)

// Closes a wav file.
#define RTC_AEC_DEBUG_WAV_CLOSE(wav_file) \
  do {                                    \
    rtc_WavClose(wav_file);               \
  } while (0)

// Dumps a raw data to file.
#define RTC_AEC_DEBUG_RAW_WRITE(file, data, data_size) \
  do {                                                 \
    (void) fwrite(data, data_size, 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 {                                                       \
    WebRtcAec_RawFileOpen(name, instance_counter, file);     \
  } while (0)

// Closes a raw data file.
#define RTC_AEC_DEBUG_RAW_CLOSE(file) \
  do {                                \
    fclose(file);                     \
  } while (0)

#else  // RTC_AEC_DEBUG_DUMP
#define RTC_AEC_DEBUG_WAV_WRITE(file, data, num_samples) \
  do {                                                   \
  } while (0)

#define RTC_AEC_DEBUG_WAV_REOPEN(wav_file, name, instance_index, process_rate, \
                                 sample_rate)                                  \
  do {                                                                         \
  } while (0)

#define RTC_AEC_DEBUG_WAV_CLOSE(wav_file) \
  do {                                    \
  } while (0)

#define RTC_AEC_DEBUG_RAW_WRITE(file, data, data_size) \
  do {                                                 \
  } while (0)

#define RTC_AEC_DEBUG_RAW_OPEN(file, name, instance_counter) \
  do {                                                       \
  } while (0)

#define RTC_AEC_DEBUG_RAW_CLOSE(file) \
  do {                                \
  } while (0)

#endif  // WEBRTC_AEC_DEBUG_DUMP

#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_LOGGING_