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

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

Issue 1776363002: Use ProcessReverseStream in VoiceEngines OutputMixer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@reverse2
Patch Set: Take the lock in the right place Created 4 years, 9 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 capture_nonlocked_.beamformer_enabled = config.Get<Beamforming>().enabled; 435 capture_nonlocked_.beamformer_enabled = config.Get<Beamforming>().enabled;
436 if (config.Get<Beamforming>().array_geometry.size() > 1) { 436 if (config.Get<Beamforming>().array_geometry.size() > 1) {
437 capture_.array_geometry = config.Get<Beamforming>().array_geometry; 437 capture_.array_geometry = config.Get<Beamforming>().array_geometry;
438 } 438 }
439 capture_.target_direction = config.Get<Beamforming>().target_direction; 439 capture_.target_direction = config.Get<Beamforming>().target_direction;
440 InitializeBeamformer(); 440 InitializeBeamformer();
441 } 441 }
442 #endif // WEBRTC_ANDROID_PLATFORM_BUILD 442 #endif // WEBRTC_ANDROID_PLATFORM_BUILD
443 } 443 }
444 444
445 int AudioProcessingImpl::input_sample_rate_hz() const {
446 // Accessed from outside APM, hence a lock is needed.
447 rtc::CritScope cs(&crit_capture_);
448 return formats_.api_format.input_stream().sample_rate_hz();
449 }
450
451 int AudioProcessingImpl::proc_sample_rate_hz() const { 445 int AudioProcessingImpl::proc_sample_rate_hz() const {
452 // Used as callback from submodules, hence locking is not allowed. 446 // Used as callback from submodules, hence locking is not allowed.
453 return capture_nonlocked_.fwd_proc_format.sample_rate_hz(); 447 return capture_nonlocked_.fwd_proc_format.sample_rate_hz();
454 } 448 }
455 449
456 int AudioProcessingImpl::proc_split_sample_rate_hz() const { 450 int AudioProcessingImpl::proc_split_sample_rate_hz() const {
457 // Used as callback from submodules, hence locking is not allowed. 451 // Used as callback from submodules, hence locking is not allowed.
458 return capture_nonlocked_.split_rate; 452 return capture_nonlocked_.split_rate;
459 } 453 }
460 454
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 827 }
834 #endif 828 #endif
835 829
836 render_.render_audio->CopyFrom(src, 830 render_.render_audio->CopyFrom(src,
837 formats_.api_format.reverse_input_stream()); 831 formats_.api_format.reverse_input_stream());
838 return ProcessReverseStreamLocked(); 832 return ProcessReverseStreamLocked();
839 } 833 }
840 834
841 int AudioProcessingImpl::ProcessReverseStream(AudioFrame* frame) { 835 int AudioProcessingImpl::ProcessReverseStream(AudioFrame* frame) {
842 TRACE_EVENT0("webrtc", "AudioProcessing::ProcessReverseStream_AudioFrame"); 836 TRACE_EVENT0("webrtc", "AudioProcessing::ProcessReverseStream_AudioFrame");
837 rtc::CritScope cs(&crit_render_);
843 RETURN_ON_ERR(AnalyzeReverseStream(frame)); 838 RETURN_ON_ERR(AnalyzeReverseStream(frame));
844 rtc::CritScope cs(&crit_render_);
845 if (is_rev_processed()) { 839 if (is_rev_processed()) {
846 render_.render_audio->InterleaveTo(frame, true); 840 render_.render_audio->InterleaveTo(frame, true);
847 } 841 }
848 842
849 return kNoError; 843 return kNoError;
850 } 844 }
851 845
852 int AudioProcessingImpl::AnalyzeReverseStream(AudioFrame* frame) { 846 int AudioProcessingImpl::AnalyzeReverseStream(AudioFrame* frame) {
853 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_AudioFrame"); 847 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_AudioFrame");
854 rtc::CritScope cs(&crit_render_); 848 rtc::CritScope cs(&crit_render_);
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); 1436 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
1443 1437
1444 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 1438 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
1445 &debug_dump_.num_bytes_left_for_log_, 1439 &debug_dump_.num_bytes_left_for_log_,
1446 &crit_debug_, &debug_dump_.capture)); 1440 &crit_debug_, &debug_dump_.capture));
1447 return kNoError; 1441 return kNoError;
1448 } 1442 }
1449 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1443 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1450 1444
1451 } // namespace webrtc 1445 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/audio_processing_impl.h ('k') | webrtc/modules/audio_processing/include/audio_processing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698