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

Side by Side Diff: webrtc/modules/audio_processing/aec_dumper/aec_dumper.h

Issue 2747123007: Test submission of complete AEC-dump refactoring. (Closed)
Patch Set: Most of Karl's comments addressed. Created 3 years, 8 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMPER_AEC_DUMPER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMPER_AEC_DUMPER_H_
13
14 #include <memory>
15 #include <string>
16 #include <vector>
17
18 #include "webrtc/base/array_view.h"
19 #include "webrtc/modules/audio_processing/include/audio_processing.h"
20
21 namespace audioproc {
22 class Event;
23 } // namespace audioproc
24
25 namespace rtc {
26 class TaskQueue;
27 } // namespace rtc
28
29 namespace webrtc {
30
31 class AudioFrame;
32
33 // Struct for passing current config from APM without having to
34 // include protobuf headers.
35 struct InternalAPMConfig {
36 InternalAPMConfig();
37
38 bool aec_enabled = false;
39 bool aec_delay_agnostic_enabled = false;
40 bool aec_drift_compensation_enabled = false;
41 bool aec_extended_filter_enabled = false;
42 int aec_suppression_level = 0;
43 bool aecm_enabled = false;
44 bool aecm_comfort_noise_enabled = false;
45 int aecm_routing_mode = 0;
46 bool agc_enabled = false;
47 int agc_mode = 0;
48 bool agc_limiter_enabled = false;
49 bool hpf_enabled = false;
50 bool ns_enabled = false;
51 int ns_level = 0;
52 bool transient_suppression_enabled = false;
53 bool intelligibility_enhancer_enabled = false;
54 bool noise_robust_agc_enabled = false;
55 std::string experiments_description = "";
56
57 private:
58 RTC_DISALLOW_COPY_AND_ASSIGN(InternalAPMConfig);
kwiberg-webrtc 2017/03/29 08:57:11 You don't have to use this macro anymore. Just do
59 };
60
61 class AecDumper {
62 public:
63 // A capture stream frame is logged before and after processing in
64 // the same protobuf message. To facilitate that, a
65 // CaptureStreamInfo instance is first filled with Input, then
66 // Output.
67 //
68 // To log an input/output pair, first call
69 // AecDumper::GetCaptureStreamInfo. Add the input and output to
70 // it. Then call AecDumper::WriteCaptureStreamMessage.
71 class CaptureStreamInfo {
72 public:
73 virtual ~CaptureStreamInfo() = default;
74 virtual void AddInput(std::vector<rtc::ArrayView<const float>> src) = 0;
75 virtual void AddOutput(std::vector<rtc::ArrayView<const float>> src) = 0;
76
77 virtual void AddInput(const AudioFrame& frame) = 0;
78 virtual void AddOutput(const AudioFrame& frame) = 0;
79
80 virtual void set_delay(int delay) = 0;
81 virtual void set_drift(int drift) = 0;
82 virtual void set_level(int level) = 0;
83 virtual void set_keypress(bool keypress) = 0;
84 };
85
86 AecDumper() = default;
kwiberg-webrtc 2017/03/29 08:57:11 You forgot to remove this one.
87
88 virtual ~AecDumper() = default;
89
90 // TODO(aleloi): update comments to new creation scheme.
91 // If called when a recording is active, that file is closed, and a
92 // new file is opened. Messages waiting to be written asynchronously
93 // to the old file may be lost. Returns true iff opening file for
94 // writing succeeded.
95
96 // Closes associated file. Messages waiting to be written to file
97 // asynchronously may be lost. This method is safe to call when no
98 // recording is active. A recording does not have to be closed
99 // manually with this method; instead the AecDumper instance may be
100 // destroyed.
101 static std::unique_ptr<AecDumper> Create(std::string file_name,
102 int64_t max_log_size_bytes,
103 rtc::TaskQueue* worker_queue);
104 static std::unique_ptr<AecDumper> Create(FILE* handle,
105 int64_t max_log_size_bytes,
106 rtc::TaskQueue* worker_queue);
107
108 static std::unique_ptr<AecDumper> CreateNullDumper();
109
110 virtual std::unique_ptr<CaptureStreamInfo> GetCaptureStreamInfo() = 0;
111
112 // The Write* methods are always safe to call. If no recording is in
113 // progress, calls will have no effect. Messages are written to file
114 // in a 'best effort' manner. If the AecDumper can't keep up with
115 // the flow of messages, some will be silently dropped.
116 virtual void WriteInitMessage(const ProcessingConfig& api_format) = 0;
117
118 virtual void WriteReverseStreamMessage(const AudioFrame& frame) = 0;
119
120 virtual void WriteReverseStreamMessage(
121 std::vector<rtc::ArrayView<const float>> src) = 0;
122
123 virtual void WriteCaptureStreamMessage(
124 std::unique_ptr<CaptureStreamInfo> stream_info) = 0;
125
126 // If not |forced|, only writes the current config if it is
127 // different from the last saved one; if |forced|, writes the config
128 // regardless of the last saved.
129 virtual void WriteConfig(const InternalAPMConfig& config, bool forced) = 0;
130 };
131 } // namespace webrtc
132
133 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_DUMPER_AEC_DUMPER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/aec_dumper/BUILD.gn ('k') | webrtc/modules/audio_processing/aec_dumper/aec_dumper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698