Reland "Added option to specify a maximum file size when recording an AEC dump.", commit ae2c5ad12afc8cc29fe9c59dea432b697b871a87.
The revert of the original CL was commit 36d4c545007129446e551c45c17b25377dce89a4.
Original review: https://codereview.webrtc.org/1413483003/
The original CL changes a function on audio_processing.h that is used by Chrome, this CL adds back the old function.
TBR=glaznev@webrtc.org, henrik.lundin@webrtc.org, solenberg@google.com, henrikg@webrtc.org, perkj@webrtc.org
BUG=webrtc:4741
Committed: https://crrev.com/f4f5cb09277d5ef6aeac8341e5f54a055867803a
Cr-Commit-Position: refs/heads/master@{#11093}
Review URL: https://codereview.webrtc.org/1540103002
Cr-Commit-Position: refs/heads/master@{#11267}
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h
index b310896..fbb9b6e 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.h
+++ b/webrtc/modules/audio_processing/audio_processing_impl.h
@@ -57,8 +57,10 @@
int Initialize(const ProcessingConfig& processing_config) override;
void SetExtraOptions(const Config& config) override;
void UpdateHistogramsOnCallEnd() override;
- int StartDebugRecording(const char filename[kMaxFilenameSize]) override;
- int StartDebugRecording(FILE* handle) override;
+ int StartDebugRecording(const char filename[kMaxFilenameSize],
+ int64_t max_log_size_bytes) override;
+ int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) override;
+
int StartDebugRecordingForPlatformFile(rtc::PlatformFile handle) override;
int StopDebugRecording() override;
@@ -144,6 +146,9 @@
struct ApmDebugDumpState {
ApmDebugDumpState() : debug_file(FileWrapper::Create()) {}
+ // Number of bytes that can still be written to the log before the maximum
+ // size is reached. A value of <= 0 indicates that no limit is used.
+ int64_t num_bytes_left_for_log_ = -1;
rtc::scoped_ptr<FileWrapper> debug_file;
ApmDebugDumpThreadState render;
ApmDebugDumpThreadState capture;
@@ -222,6 +227,7 @@
// TODO(andrew): make this more graceful. Ideally we would split this stuff
// out into a separate class with an "enabled" and "disabled" implementation.
static int WriteMessageToDebugFile(FileWrapper* debug_file,
+ int64_t* filesize_limit_bytes,
rtc::CriticalSection* crit_debug,
ApmDebugDumpThreadState* debug_state);
int WriteInitMessage() EXCLUSIVE_LOCKS_REQUIRED(crit_render_, crit_capture_);