aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/audio_processing/audio_processing_impl.cc
diff options
context:
space:
mode:
authorivoc <ivoc@webrtc.org>2015-12-18 08:05:17 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-18 16:05:21 +0000
commit36d4c545007129446e551c45c17b25377dce89a4 (patch)
treee917f238e8f5c3592ea236b526f8e679ab825d10 /webrtc/modules/audio_processing/audio_processing_impl.cc
parent455a252453eac87853acb776f08d0da773ad8079 (diff)
downloadwebrtc-36d4c545007129446e551c45c17b25377dce89a4.tar.gz
Revert of Added option to specify a maximum file size when recording an AEC dump. (patchset #5 id:120001 of https://codereview.webrtc.org/1413483003/ )
Reason for revert: Breaks Chrome-FYI bots because of a change in the StartDebugRecording function in audio_processing.h, that is called from Chrome. Original issue's description: > 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 > > Committed: https://crrev.com/ae2c5ad12afc8cc29fe9c59dea432b697b871a87 > Cr-Commit-Position: refs/heads/master@{#11081} TBR=pthatcher@webrtc.org,henrik.lundin@webrtc.org,henrikg@webrtc.org,solenberg@webrtc.org,andrew@webrtc.org,kwiberg@webrtc.org,perkj@webrtc.org,glaznev@webrtc.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:4741 Review URL: https://codereview.webrtc.org/1533913004 Cr-Commit-Position: refs/heads/master@{#11087}
Diffstat (limited to 'webrtc/modules/audio_processing/audio_processing_impl.cc')
-rw-r--r--webrtc/modules/audio_processing/audio_processing_impl.cc32
1 files changed, 4 insertions, 28 deletions
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index b79b4f0c76..a332945343 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -632,7 +632,6 @@ int AudioProcessingImpl::ProcessStream(const float* const* src,
for (int i = 0; i < formats_.api_format.output_stream().num_channels(); ++i)
msg->add_output_channel(dest[i], channel_size);
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.capture));
}
#endif
@@ -720,7 +719,6 @@ int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_;
msg->set_output_data(frame->data_, data_size);
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.capture));
}
#endif
@@ -888,7 +886,6 @@ int AudioProcessingImpl::AnalyzeReverseStreamLocked(
i < formats_.api_format.reverse_input_stream().num_channels(); ++i)
msg->add_channel(src[i], channel_size);
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.render));
}
#endif
@@ -957,7 +954,6 @@ int AudioProcessingImpl::AnalyzeReverseStream(AudioFrame* frame) {
sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_;
msg->set_data(frame->data_, data_size);
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.render));
}
#endif
@@ -1043,8 +1039,7 @@ int AudioProcessingImpl::delay_offset_ms() const {
}
int AudioProcessingImpl::StartDebugRecording(
- const char filename[AudioProcessing::kMaxFilenameSize],
- int64_t max_log_size_bytes) {
+ const char filename[AudioProcessing::kMaxFilenameSize]) {
// Run in a single-threaded manner.
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
@@ -1055,7 +1050,6 @@ int AudioProcessingImpl::StartDebugRecording(
}
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
- debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes;
// Stop any ongoing recording.
if (debug_dump_.debug_file->Open()) {
if (debug_dump_.debug_file->CloseFile() == -1) {
@@ -1076,8 +1070,7 @@ int AudioProcessingImpl::StartDebugRecording(
#endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
}
-int AudioProcessingImpl::StartDebugRecording(FILE* handle,
- int64_t max_log_size_bytes) {
+int AudioProcessingImpl::StartDebugRecording(FILE* handle) {
// Run in a single-threaded manner.
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
@@ -1087,8 +1080,6 @@ int AudioProcessingImpl::StartDebugRecording(FILE* handle,
}
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
- debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes;
-
// Stop any ongoing recording.
if (debug_dump_.debug_file->Open()) {
if (debug_dump_.debug_file->CloseFile() == -1) {
@@ -1114,7 +1105,7 @@ int AudioProcessingImpl::StartDebugRecordingForPlatformFile(
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
FILE* stream = rtc::FdopenPlatformFileForWriting(handle);
- return StartDebugRecording(stream, -1);
+ return StartDebugRecording(stream);
}
int AudioProcessingImpl::StopDebugRecording() {
@@ -1409,7 +1400,6 @@ void AudioProcessingImpl::UpdateHistogramsOnCallEnd() {
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
int AudioProcessingImpl::WriteMessageToDebugFile(
FileWrapper* debug_file,
- int64_t* filesize_limit_bytes,
rtc::CriticalSection* crit_debug,
ApmDebugDumpThreadState* debug_state) {
int32_t size = debug_state->event_msg->ByteSize();
@@ -1427,19 +1417,7 @@ int AudioProcessingImpl::WriteMessageToDebugFile(
{
// Ensure atomic writes of the message.
- rtc::CritScope cs_debug(crit_debug);
-
- RTC_DCHECK(debug_file->Open());
- // Update the byte counter.
- if (*filesize_limit_bytes >= 0) {
- *filesize_limit_bytes -=
- (sizeof(int32_t) + debug_state->event_str.length());
- if (*filesize_limit_bytes < 0) {
- // Not enough bytes are left to write this message, so stop logging.
- debug_file->CloseFile();
- return kNoError;
- }
- }
+ rtc::CritScope cs_capture(crit_debug);
// Write message preceded by its size.
if (!debug_file->Write(&size, sizeof(int32_t))) {
return kFileError;
@@ -1474,7 +1452,6 @@ int AudioProcessingImpl::WriteInitMessage() {
// debug_dump_.capture.event_msg.
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.capture));
return kNoError;
}
@@ -1527,7 +1504,6 @@ int AudioProcessingImpl::WriteConfigMessage(bool forced) {
debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
- &debug_dump_.num_bytes_left_for_log_,
&crit_debug_, &debug_dump_.capture));
return kNoError;
}