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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2054373002: FileWrapper[Impl] modifications and actually remove the "Impl" class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix use of ASSERT instead of ASSERT_TRUE in test Created 4 years, 6 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
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 AudioProcessingImpl::~AudioProcessingImpl() { 206 AudioProcessingImpl::~AudioProcessingImpl() {
207 // Depends on gain_control_ and 207 // Depends on gain_control_ and
208 // public_submodules_->gain_control_for_experimental_agc. 208 // public_submodules_->gain_control_for_experimental_agc.
209 private_submodules_->agc_manager.reset(); 209 private_submodules_->agc_manager.reset();
210 // Depends on gain_control_. 210 // Depends on gain_control_.
211 public_submodules_->gain_control_for_experimental_agc.reset(); 211 public_submodules_->gain_control_for_experimental_agc.reset();
212 212
213 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 213 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
214 if (debug_dump_.debug_file->Open()) { 214 debug_dump_.debug_file->CloseFile();
215 debug_dump_.debug_file->CloseFile();
216 }
217 #endif 215 #endif
218 } 216 }
219 217
220 int AudioProcessingImpl::Initialize() { 218 int AudioProcessingImpl::Initialize() {
221 // Run in a single-threaded manner during initialization. 219 // Run in a single-threaded manner during initialization.
222 rtc::CritScope cs_render(&crit_render_); 220 rtc::CritScope cs_render(&crit_render_);
223 rtc::CritScope cs_capture(&crit_capture_); 221 rtc::CritScope cs_capture(&crit_capture_);
224 return InitializeLocked(); 222 return InitializeLocked();
225 } 223 }
226 224
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 InitializeExperimentalAgc(); 317 InitializeExperimentalAgc();
320 InitializeTransient(); 318 InitializeTransient();
321 InitializeBeamformer(); 319 InitializeBeamformer();
322 InitializeIntelligibility(); 320 InitializeIntelligibility();
323 InitializeHighPassFilter(); 321 InitializeHighPassFilter();
324 InitializeNoiseSuppression(); 322 InitializeNoiseSuppression();
325 InitializeLevelEstimator(); 323 InitializeLevelEstimator();
326 InitializeVoiceDetection(); 324 InitializeVoiceDetection();
327 325
328 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 326 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
329 if (debug_dump_.debug_file->Open()) { 327 if (debug_dump_.debug_file->is_open()) {
330 int err = WriteInitMessage(); 328 int err = WriteInitMessage();
331 if (err != kNoError) { 329 if (err != kNoError) {
332 return err; 330 return err;
333 } 331 }
334 } 332 }
335 #endif 333 #endif
336 334
337 return kNoError; 335 return kNoError;
338 } 336 }
339 337
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 { 528 {
531 // Do conditional reinitialization. 529 // Do conditional reinitialization.
532 rtc::CritScope cs_render(&crit_render_); 530 rtc::CritScope cs_render(&crit_render_);
533 RETURN_ON_ERR(MaybeInitializeCapture(processing_config)); 531 RETURN_ON_ERR(MaybeInitializeCapture(processing_config));
534 } 532 }
535 rtc::CritScope cs_capture(&crit_capture_); 533 rtc::CritScope cs_capture(&crit_capture_);
536 assert(processing_config.input_stream().num_frames() == 534 assert(processing_config.input_stream().num_frames() ==
537 formats_.api_format.input_stream().num_frames()); 535 formats_.api_format.input_stream().num_frames());
538 536
539 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 537 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
540 if (debug_dump_.debug_file->Open()) { 538 if (debug_dump_.debug_file->is_open()) {
541 RETURN_ON_ERR(WriteConfigMessage(false)); 539 RETURN_ON_ERR(WriteConfigMessage(false));
542 540
543 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM); 541 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM);
544 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 542 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
545 const size_t channel_size = 543 const size_t channel_size =
546 sizeof(float) * formats_.api_format.input_stream().num_frames(); 544 sizeof(float) * formats_.api_format.input_stream().num_frames();
547 for (size_t i = 0; i < formats_.api_format.input_stream().num_channels(); 545 for (size_t i = 0; i < formats_.api_format.input_stream().num_channels();
548 ++i) 546 ++i)
549 msg->add_input_channel(src[i], channel_size); 547 msg->add_input_channel(src[i], channel_size);
550 } 548 }
551 #endif 549 #endif
552 550
553 capture_.capture_audio->CopyFrom(src, formats_.api_format.input_stream()); 551 capture_.capture_audio->CopyFrom(src, formats_.api_format.input_stream());
554 RETURN_ON_ERR(ProcessStreamLocked()); 552 RETURN_ON_ERR(ProcessStreamLocked());
555 capture_.capture_audio->CopyTo(formats_.api_format.output_stream(), dest); 553 capture_.capture_audio->CopyTo(formats_.api_format.output_stream(), dest);
556 554
557 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 555 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
558 if (debug_dump_.debug_file->Open()) { 556 if (debug_dump_.debug_file->is_open()) {
559 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 557 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
560 const size_t channel_size = 558 const size_t channel_size =
561 sizeof(float) * formats_.api_format.output_stream().num_frames(); 559 sizeof(float) * formats_.api_format.output_stream().num_frames();
562 for (size_t i = 0; i < formats_.api_format.output_stream().num_channels(); 560 for (size_t i = 0; i < formats_.api_format.output_stream().num_channels();
563 ++i) 561 ++i)
564 msg->add_output_channel(dest[i], channel_size); 562 msg->add_output_channel(dest[i], channel_size);
565 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 563 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
566 &debug_dump_.num_bytes_left_for_log_, 564 &debug_dump_.num_bytes_left_for_log_,
567 &crit_debug_, &debug_dump_.capture)); 565 &crit_debug_, &debug_dump_.capture));
568 } 566 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 rtc::CritScope cs_render(&crit_render_); 615 rtc::CritScope cs_render(&crit_render_);
618 RETURN_ON_ERR(MaybeInitializeCapture(processing_config)); 616 RETURN_ON_ERR(MaybeInitializeCapture(processing_config));
619 } 617 }
620 rtc::CritScope cs_capture(&crit_capture_); 618 rtc::CritScope cs_capture(&crit_capture_);
621 if (frame->samples_per_channel_ != 619 if (frame->samples_per_channel_ !=
622 formats_.api_format.input_stream().num_frames()) { 620 formats_.api_format.input_stream().num_frames()) {
623 return kBadDataLengthError; 621 return kBadDataLengthError;
624 } 622 }
625 623
626 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 624 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
627 if (debug_dump_.debug_file->Open()) { 625 if (debug_dump_.debug_file->is_open()) {
628 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM); 626 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM);
629 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 627 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
630 const size_t data_size = 628 const size_t data_size =
631 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; 629 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_;
632 msg->set_input_data(frame->data_, data_size); 630 msg->set_input_data(frame->data_, data_size);
633 } 631 }
634 #endif 632 #endif
635 633
636 capture_.capture_audio->DeinterleaveFrom(frame); 634 capture_.capture_audio->DeinterleaveFrom(frame);
637 RETURN_ON_ERR(ProcessStreamLocked()); 635 RETURN_ON_ERR(ProcessStreamLocked());
638 capture_.capture_audio->InterleaveTo(frame, output_copy_needed()); 636 capture_.capture_audio->InterleaveTo(frame, output_copy_needed());
639 637
640 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 638 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
641 if (debug_dump_.debug_file->Open()) { 639 if (debug_dump_.debug_file->is_open()) {
642 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 640 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
643 const size_t data_size = 641 const size_t data_size =
644 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; 642 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_;
645 msg->set_output_data(frame->data_, data_size); 643 msg->set_output_data(frame->data_, data_size);
646 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 644 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
647 &debug_dump_.num_bytes_left_for_log_, 645 &debug_dump_.num_bytes_left_for_log_,
648 &crit_debug_, &debug_dump_.capture)); 646 &crit_debug_, &debug_dump_.capture));
649 } 647 }
650 #endif 648 #endif
651 649
652 return kNoError; 650 return kNoError;
653 } 651 }
654 652
655 int AudioProcessingImpl::ProcessStreamLocked() { 653 int AudioProcessingImpl::ProcessStreamLocked() {
656 // Ensure that not both the AEC and AECM are active at the same time. 654 // Ensure that not both the AEC and AECM are active at the same time.
657 // TODO(peah): Simplify once the public API Enable functions for these 655 // TODO(peah): Simplify once the public API Enable functions for these
658 // are moved to APM. 656 // are moved to APM.
659 RTC_DCHECK(!(public_submodules_->echo_cancellation->is_enabled() && 657 RTC_DCHECK(!(public_submodules_->echo_cancellation->is_enabled() &&
660 public_submodules_->echo_control_mobile->is_enabled())); 658 public_submodules_->echo_control_mobile->is_enabled()));
661 659
662 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 660 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
663 if (debug_dump_.debug_file->Open()) { 661 if (debug_dump_.debug_file->is_open()) {
664 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 662 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
665 msg->set_delay(capture_nonlocked_.stream_delay_ms); 663 msg->set_delay(capture_nonlocked_.stream_delay_ms);
666 msg->set_drift( 664 msg->set_drift(
667 public_submodules_->echo_cancellation->stream_drift_samples()); 665 public_submodules_->echo_cancellation->stream_drift_samples());
668 msg->set_level(gain_control()->stream_analog_level()); 666 msg->set_level(gain_control()->stream_analog_level());
669 msg->set_keypress(capture_.key_pressed); 667 msg->set_keypress(capture_.key_pressed);
670 } 668 }
671 #endif 669 #endif
672 670
673 MaybeUpdateHistograms(); 671 MaybeUpdateHistograms();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 819
822 ProcessingConfig processing_config = formats_.api_format; 820 ProcessingConfig processing_config = formats_.api_format;
823 processing_config.reverse_input_stream() = reverse_input_config; 821 processing_config.reverse_input_stream() = reverse_input_config;
824 processing_config.reverse_output_stream() = reverse_output_config; 822 processing_config.reverse_output_stream() = reverse_output_config;
825 823
826 RETURN_ON_ERR(MaybeInitializeRender(processing_config)); 824 RETURN_ON_ERR(MaybeInitializeRender(processing_config));
827 assert(reverse_input_config.num_frames() == 825 assert(reverse_input_config.num_frames() ==
828 formats_.api_format.reverse_input_stream().num_frames()); 826 formats_.api_format.reverse_input_stream().num_frames());
829 827
830 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 828 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
831 if (debug_dump_.debug_file->Open()) { 829 if (debug_dump_.debug_file->is_open()) {
832 debug_dump_.render.event_msg->set_type(audioproc::Event::REVERSE_STREAM); 830 debug_dump_.render.event_msg->set_type(audioproc::Event::REVERSE_STREAM);
833 audioproc::ReverseStream* msg = 831 audioproc::ReverseStream* msg =
834 debug_dump_.render.event_msg->mutable_reverse_stream(); 832 debug_dump_.render.event_msg->mutable_reverse_stream();
835 const size_t channel_size = 833 const size_t channel_size =
836 sizeof(float) * formats_.api_format.reverse_input_stream().num_frames(); 834 sizeof(float) * formats_.api_format.reverse_input_stream().num_frames();
837 for (size_t i = 0; 835 for (size_t i = 0;
838 i < formats_.api_format.reverse_input_stream().num_channels(); ++i) 836 i < formats_.api_format.reverse_input_stream().num_channels(); ++i)
839 msg->add_channel(src[i], channel_size); 837 msg->add_channel(src[i], channel_size);
840 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 838 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
841 &debug_dump_.num_bytes_left_for_log_, 839 &debug_dump_.num_bytes_left_for_log_,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 processing_config.reverse_output_stream().set_num_channels( 874 processing_config.reverse_output_stream().set_num_channels(
877 frame->num_channels_); 875 frame->num_channels_);
878 876
879 RETURN_ON_ERR(MaybeInitializeRender(processing_config)); 877 RETURN_ON_ERR(MaybeInitializeRender(processing_config));
880 if (frame->samples_per_channel_ != 878 if (frame->samples_per_channel_ !=
881 formats_.api_format.reverse_input_stream().num_frames()) { 879 formats_.api_format.reverse_input_stream().num_frames()) {
882 return kBadDataLengthError; 880 return kBadDataLengthError;
883 } 881 }
884 882
885 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 883 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
886 if (debug_dump_.debug_file->Open()) { 884 if (debug_dump_.debug_file->is_open()) {
887 debug_dump_.render.event_msg->set_type(audioproc::Event::REVERSE_STREAM); 885 debug_dump_.render.event_msg->set_type(audioproc::Event::REVERSE_STREAM);
888 audioproc::ReverseStream* msg = 886 audioproc::ReverseStream* msg =
889 debug_dump_.render.event_msg->mutable_reverse_stream(); 887 debug_dump_.render.event_msg->mutable_reverse_stream();
890 const size_t data_size = 888 const size_t data_size =
891 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; 889 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_;
892 msg->set_data(frame->data_, data_size); 890 msg->set_data(frame->data_, data_size);
893 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 891 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
894 &debug_dump_.num_bytes_left_for_log_, 892 &debug_dump_.num_bytes_left_for_log_,
895 &crit_debug_, &debug_dump_.render)); 893 &crit_debug_, &debug_dump_.render));
896 } 894 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 rtc::CritScope cs_capture(&crit_capture_); 981 rtc::CritScope cs_capture(&crit_capture_);
984 static_assert(kMaxFilenameSize == FileWrapper::kMaxFileNameSize, ""); 982 static_assert(kMaxFilenameSize == FileWrapper::kMaxFileNameSize, "");
985 983
986 if (filename == nullptr) { 984 if (filename == nullptr) {
987 return kNullPointerError; 985 return kNullPointerError;
988 } 986 }
989 987
990 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 988 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
991 debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes; 989 debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes;
992 // Stop any ongoing recording. 990 // Stop any ongoing recording.
993 if (debug_dump_.debug_file->Open()) { 991 debug_dump_.debug_file->CloseFile();
994 if (debug_dump_.debug_file->CloseFile() == -1) {
995 return kFileError;
996 }
997 }
998 992
999 if (debug_dump_.debug_file->OpenFile(filename, false) == -1) { 993 if (!debug_dump_.debug_file->OpenFile(filename, false)) {
1000 debug_dump_.debug_file->CloseFile();
1001 return kFileError; 994 return kFileError;
1002 } 995 }
1003 996
1004 RETURN_ON_ERR(WriteConfigMessage(true)); 997 RETURN_ON_ERR(WriteConfigMessage(true));
1005 RETURN_ON_ERR(WriteInitMessage()); 998 RETURN_ON_ERR(WriteInitMessage());
1006 return kNoError; 999 return kNoError;
1007 #else 1000 #else
1008 return kUnsupportedFunctionError; 1001 return kUnsupportedFunctionError;
1009 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1002 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1010 } 1003 }
1011 1004
1012 int AudioProcessingImpl::StartDebugRecording(FILE* handle, 1005 int AudioProcessingImpl::StartDebugRecording(FILE* handle,
1013 int64_t max_log_size_bytes) { 1006 int64_t max_log_size_bytes) {
1014 // Run in a single-threaded manner. 1007 // Run in a single-threaded manner.
1015 rtc::CritScope cs_render(&crit_render_); 1008 rtc::CritScope cs_render(&crit_render_);
1016 rtc::CritScope cs_capture(&crit_capture_); 1009 rtc::CritScope cs_capture(&crit_capture_);
1017 1010
1018 if (handle == nullptr) { 1011 if (handle == nullptr) {
1019 return kNullPointerError; 1012 return kNullPointerError;
1020 } 1013 }
1021 1014
1022 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 1015 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
1023 debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes; 1016 debug_dump_.num_bytes_left_for_log_ = max_log_size_bytes;
1024 1017
1025 // Stop any ongoing recording. 1018 // Stop any ongoing recording.
1026 if (debug_dump_.debug_file->Open()) { 1019 debug_dump_.debug_file->CloseFile();
1027 if (debug_dump_.debug_file->CloseFile() == -1) {
1028 return kFileError;
1029 }
1030 }
1031 1020
1032 if (debug_dump_.debug_file->OpenFromFileHandle(handle, true, false) == -1) { 1021 if (!debug_dump_.debug_file->OpenFromFileHandle(handle)) {
1033 return kFileError; 1022 return kFileError;
1034 } 1023 }
1035 1024
1036 RETURN_ON_ERR(WriteConfigMessage(true)); 1025 RETURN_ON_ERR(WriteConfigMessage(true));
1037 RETURN_ON_ERR(WriteInitMessage()); 1026 RETURN_ON_ERR(WriteInitMessage());
1038 return kNoError; 1027 return kNoError;
1039 #else 1028 #else
1040 return kUnsupportedFunctionError; 1029 return kUnsupportedFunctionError;
1041 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1030 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1042 } 1031 }
1043 1032
1044 int AudioProcessingImpl::StartDebugRecordingForPlatformFile( 1033 int AudioProcessingImpl::StartDebugRecordingForPlatformFile(
1045 rtc::PlatformFile handle) { 1034 rtc::PlatformFile handle) {
1046 // Run in a single-threaded manner. 1035 // Run in a single-threaded manner.
1047 rtc::CritScope cs_render(&crit_render_); 1036 rtc::CritScope cs_render(&crit_render_);
1048 rtc::CritScope cs_capture(&crit_capture_); 1037 rtc::CritScope cs_capture(&crit_capture_);
1049 FILE* stream = rtc::FdopenPlatformFileForWriting(handle); 1038 FILE* stream = rtc::FdopenPlatformFileForWriting(handle);
1050 return StartDebugRecording(stream, -1); 1039 return StartDebugRecording(stream, -1);
1051 } 1040 }
1052 1041
1053 int AudioProcessingImpl::StopDebugRecording() { 1042 int AudioProcessingImpl::StopDebugRecording() {
1054 // Run in a single-threaded manner. 1043 // Run in a single-threaded manner.
1055 rtc::CritScope cs_render(&crit_render_); 1044 rtc::CritScope cs_render(&crit_render_);
1056 rtc::CritScope cs_capture(&crit_capture_); 1045 rtc::CritScope cs_capture(&crit_capture_);
1057 1046
1058 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 1047 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
1059 // We just return if recording hasn't started. 1048 // We just return if recording hasn't started.
1060 if (debug_dump_.debug_file->Open()) { 1049 debug_dump_.debug_file->CloseFile();
1061 if (debug_dump_.debug_file->CloseFile() == -1) {
1062 return kFileError;
1063 }
1064 }
1065 return kNoError; 1050 return kNoError;
1066 #else 1051 #else
1067 return kUnsupportedFunctionError; 1052 return kUnsupportedFunctionError;
1068 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1053 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1069 } 1054 }
1070 1055
1071 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { 1056 EchoCancellation* AudioProcessingImpl::echo_cancellation() const {
1072 // Adding a lock here has no effect as it allows any access to the submodule 1057 // Adding a lock here has no effect as it allows any access to the submodule
1073 // from the returned pointer. 1058 // from the returned pointer.
1074 return public_submodules_->echo_cancellation.get(); 1059 return public_submodules_->echo_cancellation.get();
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 #endif 1340 #endif
1356 1341
1357 if (!debug_state->event_msg->SerializeToString(&debug_state->event_str)) { 1342 if (!debug_state->event_msg->SerializeToString(&debug_state->event_str)) {
1358 return kUnspecifiedError; 1343 return kUnspecifiedError;
1359 } 1344 }
1360 1345
1361 { 1346 {
1362 // Ensure atomic writes of the message. 1347 // Ensure atomic writes of the message.
1363 rtc::CritScope cs_debug(crit_debug); 1348 rtc::CritScope cs_debug(crit_debug);
1364 1349
1365 RTC_DCHECK(debug_file->Open()); 1350 RTC_DCHECK(debug_file->is_open());
1366 // Update the byte counter. 1351 // Update the byte counter.
1367 if (*filesize_limit_bytes >= 0) { 1352 if (*filesize_limit_bytes >= 0) {
1368 *filesize_limit_bytes -= 1353 *filesize_limit_bytes -=
1369 (sizeof(int32_t) + debug_state->event_str.length()); 1354 (sizeof(int32_t) + debug_state->event_str.length());
1370 if (*filesize_limit_bytes < 0) { 1355 if (*filesize_limit_bytes < 0) {
1371 // Not enough bytes are left to write this message, so stop logging. 1356 // Not enough bytes are left to write this message, so stop logging.
1372 debug_file->CloseFile(); 1357 debug_file->CloseFile();
1373 return kNoError; 1358 return kNoError;
1374 } 1359 }
1375 } 1360 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); 1455 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
1471 1456
1472 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 1457 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
1473 &debug_dump_.num_bytes_left_for_log_, 1458 &debug_dump_.num_bytes_left_for_log_,
1474 &crit_debug_, &debug_dump_.capture)); 1459 &crit_debug_, &debug_dump_.capture));
1475 return kNoError; 1460 return kNoError;
1476 } 1461 }
1477 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1462 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1478 1463
1479 } // namespace webrtc 1464 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/test/func_test_manager.cc ('k') | webrtc/modules/audio_processing/transient/click_annotate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698