Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 | 769 |
| 776 int AudioProcessingImpl::ProcessReverseStream( | 770 int AudioProcessingImpl::ProcessReverseStream( |
| 777 const float* const* src, | 771 const float* const* src, |
| 778 const StreamConfig& reverse_input_config, | 772 const StreamConfig& reverse_input_config, |
| 779 const StreamConfig& reverse_output_config, | 773 const StreamConfig& reverse_output_config, |
| 780 float* const* dest) { | 774 float* const* dest) { |
| 781 TRACE_EVENT0("webrtc", "AudioProcessing::ProcessReverseStream_StreamConfig"); | 775 TRACE_EVENT0("webrtc", "AudioProcessing::ProcessReverseStream_StreamConfig"); |
| 782 rtc::CritScope cs(&crit_render_); | 776 rtc::CritScope cs(&crit_render_); |
| 783 RETURN_ON_ERR(AnalyzeReverseStreamLocked(src, reverse_input_config, | 777 RETURN_ON_ERR(AnalyzeReverseStreamLocked(src, reverse_input_config, |
| 784 reverse_output_config)); | 778 reverse_output_config)); |
| 785 if (is_rev_processed()) { | 779 if (is_rev_processed()) { |
|
the sun
2016/03/10 12:49:22
Remove this function:
- The name uses an ambiguous
aluebs-webrtc
2016/03/10 16:33:17
I still would argue that having a method would mak
| |
| 786 render_.render_audio->CopyTo(formats_.api_format.reverse_output_stream(), | 780 render_.render_audio->CopyTo(formats_.api_format.reverse_output_stream(), |
| 787 dest); | 781 dest); |
| 788 } else if (render_check_rev_conversion_needed()) { | 782 } else if (render_check_rev_conversion_needed()) { |
|
the sun
2016/03/10 12:49:22
Remove this function:
- It does the exact same thi
aluebs-webrtc
2016/03/10 16:33:17
Here you have a great point, but I don't think I s
| |
| 789 render_.render_converter->Convert(src, reverse_input_config.num_samples(), | 783 render_.render_converter->Convert(src, reverse_input_config.num_samples(), |
| 790 dest, | 784 dest, |
| 791 reverse_output_config.num_samples()); | 785 reverse_output_config.num_samples()); |
| 792 } else { | 786 } else { |
| 793 CopyAudioIfNeeded(src, reverse_input_config.num_frames(), | 787 CopyAudioIfNeeded(src, reverse_input_config.num_frames(), |
| 794 reverse_input_config.num_channels(), dest); | 788 reverse_input_config.num_channels(), dest); |
| 795 } | 789 } |
| 796 | 790 |
| 797 return kNoError; | 791 return kNoError; |
| 798 } | 792 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 828 i < formats_.api_format.reverse_input_stream().num_channels(); ++i) | 822 i < formats_.api_format.reverse_input_stream().num_channels(); ++i) |
| 829 msg->add_channel(src[i], channel_size); | 823 msg->add_channel(src[i], channel_size); |
| 830 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 824 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
| 831 &debug_dump_.num_bytes_left_for_log_, | 825 &debug_dump_.num_bytes_left_for_log_, |
| 832 &crit_debug_, &debug_dump_.render)); | 826 &crit_debug_, &debug_dump_.render)); |
| 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(); |
|
the sun
2016/03/10 12:49:22
Wow! So AnalyzeReverseStreamLocked() can have side
aluebs-webrtc
2016/03/10 16:33:17
As discussed offline, it doesn't, because it doesn
| |
| 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"); |
| 843 RETURN_ON_ERR(AnalyzeReverseStream(frame)); | 837 RETURN_ON_ERR(AnalyzeReverseStream(frame)); |
| 844 rtc::CritScope cs(&crit_render_); | 838 rtc::CritScope cs(&crit_render_); |
|
the sun
2016/03/11 09:49:19
You should take this lock before calling AnalyzeRe
aluebs-webrtc
2016/03/11 13:31:03
But AnalyzeReverseStream is taking this lock as we
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |