Change the way that AecDumps are created in APM
This CL changes the way that AecDumps are created in APM. Instead
of being injected, they are now created via the API.
This removes the AecDumpFactory from the API surface of APM and
makes the API more explicit.
The CL will be followed by one more CL that deprecates the usage
of the AttachAecDump API also within the audio_processing
and the fuzzer folders.
The CL also moves the aec_dump.* files from the include folder
to the aec_dump folder and changes the build files. The reasons
for this are that
1) The content of aec_dump.h is not really part of the API
surface of APM.
2) Those files anyway needed to be moved to a separate build-
target to avoid a circular build-file dependency caused by
the other changes in this CL
Bug: webrtc:5298
Change-Id: I7dd6b49de76eb44158472874e1d4ae17dca9be54
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174750
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31207}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 25b08c6..d84318f 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -33,8 +33,13 @@
#include "rtc_base/arraysize.h"
#include "rtc_base/deprecation.h"
#include "rtc_base/ref_count.h"
+#include "rtc_base/system/file_wrapper.h"
#include "rtc_base/system/rtc_export.h"
+namespace rtc {
+class TaskQueue;
+} // namespace rtc
+
namespace webrtc {
class AecDump;
@@ -600,6 +605,23 @@
// with this chunk of audio.
virtual void set_stream_key_pressed(bool key_pressed) = 0;
+ // Creates and attaches an webrtc::AecDump for recording debugging
+ // information.
+ // The |worker_queue| may not be null and must outlive the created
+ // AecDump instance. |max_log_size_bytes == -1| means the log size
+ // will be unlimited. |handle| may not be null. The AecDump takes
+ // responsibility for |handle| and closes it in the destructor. A
+ // return value of true indicates that the file has been
+ // sucessfully opened, while a value of false indicates that
+ // opening the file failed.
+ virtual bool CreateAndAttachAecDump(const std::string& file_name,
+ int64_t max_log_size_bytes,
+ rtc::TaskQueue* worker_queue) = 0;
+ virtual bool CreateAndAttachAecDump(FILE* handle,
+ int64_t max_log_size_bytes,
+ rtc::TaskQueue* worker_queue) = 0;
+
+ // TODO(webrtc:5298) Deprecated variant.
// Attaches provided webrtc::AecDump for recording debugging
// information. Log file and maximum file size logic is supposed to
// be handled by implementing instance of AecDump. Calling this