Added option to specify a maximum file size when recording an AEC dump.
For applications with a strict filesize limit for debug files,
I added an option to specify a maximum filesize for AEC dumps. An
existing unit test is extended to check that the feature works as
advertised.
BUG=webrtc:4741
TBR=glaznev@webrtc.org
Review URL: https://codereview.webrtc.org/1413483003
Cr-Commit-Position: refs/heads/master@{#11081}
diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h
index 5fcc4d4..74ceb4c 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -408,13 +408,17 @@
// Starts recording debugging information to a file specified by |filename|,
// a NULL-terminated string. If there is an ongoing recording, the old file
// will be closed, and recording will continue in the newly specified file.
- // An already existing file will be overwritten without warning.
+ // An already existing file will be overwritten without warning. A maximum
+ // file size (in bytes) for the log can be specified. The logging is stopped
+ // once the limit has been reached. If max_log_size_bytes is set to a value
+ // <= 0, no limit will be used.
static const size_t kMaxFilenameSize = 1024;
- virtual int StartDebugRecording(const char filename[kMaxFilenameSize]) = 0;
+ virtual int StartDebugRecording(const char filename[kMaxFilenameSize],
+ int64_t max_log_size_bytes) = 0;
// Same as above but uses an existing file handle. Takes ownership
// of |handle| and closes it at StopDebugRecording().
- virtual int StartDebugRecording(FILE* handle) = 0;
+ virtual int StartDebugRecording(FILE* handle, int64_t max_log_size_bytes) = 0;
// Same as above but uses an existing PlatformFile handle. Takes ownership
// of |handle| and closes it at StopDebugRecording().
diff --git a/webrtc/modules/audio_processing/include/mock_audio_processing.h b/webrtc/modules/audio_processing/include/mock_audio_processing.h
index 4ff52ba..3aea406 100644
--- a/webrtc/modules/audio_processing/include/mock_audio_processing.h
+++ b/webrtc/modules/audio_processing/include/mock_audio_processing.h
@@ -250,10 +250,11 @@
void(int offset));
MOCK_CONST_METHOD0(delay_offset_ms,
int());
- MOCK_METHOD1(StartDebugRecording,
- int(const char filename[kMaxFilenameSize]));
- MOCK_METHOD1(StartDebugRecording,
- int(FILE* handle));
+ MOCK_METHOD2(StartDebugRecording,
+ int(const char filename[kMaxFilenameSize],
+ int64_t max_log_size_bytes));
+ MOCK_METHOD2(StartDebugRecording,
+ int(FILE* handle, int64_t max_log_size_bytes));
MOCK_METHOD0(StopDebugRecording,
int());
MOCK_METHOD0(UpdateHistogramsOnCallEnd, void());