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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 delete crit_; | 275 delete crit_; |
276 crit_ = NULL; | 276 crit_ = NULL; |
277 } | 277 } |
278 | 278 |
279 int AudioProcessingImpl::Initialize() { | 279 int AudioProcessingImpl::Initialize() { |
280 CriticalSectionScoped crit_scoped(crit_); | 280 CriticalSectionScoped crit_scoped(crit_); |
281 return InitializeLocked(); | 281 return InitializeLocked(); |
282 } | 282 } |
283 | 283 |
284 int AudioProcessingImpl::set_sample_rate_hz(int rate) { | |
285 CriticalSectionScoped crit_scoped(crit_); | |
286 | |
287 ProcessingConfig processing_config = api_format_; | |
288 processing_config.input_stream().set_sample_rate_hz(rate); | |
289 processing_config.output_stream().set_sample_rate_hz(rate); | |
290 return InitializeLocked(processing_config); | |
291 } | |
292 | |
293 int AudioProcessingImpl::Initialize(int input_sample_rate_hz, | 284 int AudioProcessingImpl::Initialize(int input_sample_rate_hz, |
294 int output_sample_rate_hz, | 285 int output_sample_rate_hz, |
295 int reverse_sample_rate_hz, | 286 int reverse_sample_rate_hz, |
296 ChannelLayout input_layout, | 287 ChannelLayout input_layout, |
297 ChannelLayout output_layout, | 288 ChannelLayout output_layout, |
298 ChannelLayout reverse_layout) { | 289 ChannelLayout reverse_layout) { |
299 const ProcessingConfig processing_config = { | 290 const ProcessingConfig processing_config = { |
300 {{input_sample_rate_hz, | 291 {{input_sample_rate_hz, |
301 ChannelsFromLayout(input_layout), | 292 ChannelsFromLayout(input_layout), |
302 LayoutHasKeyboard(input_layout)}, | 293 LayoutHasKeyboard(input_layout)}, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 for (auto item : component_list_) { | 459 for (auto item : component_list_) { |
469 item->SetExtraOptions(config); | 460 item->SetExtraOptions(config); |
470 } | 461 } |
471 | 462 |
472 if (transient_suppressor_enabled_ != config.Get<ExperimentalNs>().enabled) { | 463 if (transient_suppressor_enabled_ != config.Get<ExperimentalNs>().enabled) { |
473 transient_suppressor_enabled_ = config.Get<ExperimentalNs>().enabled; | 464 transient_suppressor_enabled_ = config.Get<ExperimentalNs>().enabled; |
474 InitializeTransient(); | 465 InitializeTransient(); |
475 } | 466 } |
476 } | 467 } |
477 | 468 |
478 int AudioProcessingImpl::input_sample_rate_hz() const { | |
479 CriticalSectionScoped crit_scoped(crit_); | |
480 return api_format_.input_stream().sample_rate_hz(); | |
481 } | |
482 | |
483 int AudioProcessingImpl::sample_rate_hz() const { | |
484 CriticalSectionScoped crit_scoped(crit_); | |
485 return api_format_.input_stream().sample_rate_hz(); | |
486 } | |
487 | 469 |
488 int AudioProcessingImpl::proc_sample_rate_hz() const { | 470 int AudioProcessingImpl::proc_sample_rate_hz() const { |
489 return fwd_proc_format_.sample_rate_hz(); | 471 return fwd_proc_format_.sample_rate_hz(); |
490 } | 472 } |
491 | 473 |
492 int AudioProcessingImpl::proc_split_sample_rate_hz() const { | 474 int AudioProcessingImpl::proc_split_sample_rate_hz() const { |
493 return split_rate_; | 475 return split_rate_; |
494 } | 476 } |
495 | 477 |
496 int AudioProcessingImpl::num_reverse_channels() const { | 478 int AudioProcessingImpl::num_reverse_channels() const { |
497 return rev_proc_format_.num_channels(); | 479 return rev_proc_format_.num_channels(); |
498 } | 480 } |
499 | 481 |
500 int AudioProcessingImpl::num_input_channels() const { | 482 int AudioProcessingImpl::num_input_channels() const { |
501 return api_format_.input_stream().num_channels(); | 483 return api_format_.input_stream().num_channels(); |
502 } | 484 } |
503 | 485 |
504 int AudioProcessingImpl::num_output_channels() const { | 486 int AudioProcessingImpl::num_output_channels() const { |
505 return api_format_.output_stream().num_channels(); | 487 return api_format_.output_stream().num_channels(); |
506 } | 488 } |
507 | 489 |
508 void AudioProcessingImpl::set_output_will_be_muted(bool muted) { | 490 void AudioProcessingImpl::set_output_will_be_muted(bool muted) { |
509 CriticalSectionScoped lock(crit_); | 491 CriticalSectionScoped lock(crit_); |
510 output_will_be_muted_ = muted; | 492 output_will_be_muted_ = muted; |
511 if (agc_manager_.get()) { | 493 if (agc_manager_.get()) { |
512 agc_manager_->SetCaptureMuted(output_will_be_muted_); | 494 agc_manager_->SetCaptureMuted(output_will_be_muted_); |
513 } | 495 } |
514 } | 496 } |
515 | 497 |
516 bool AudioProcessingImpl::output_will_be_muted() const { | |
517 CriticalSectionScoped lock(crit_); | |
518 return output_will_be_muted_; | |
519 } | |
520 | 498 |
521 int AudioProcessingImpl::ProcessStream(const float* const* src, | 499 int AudioProcessingImpl::ProcessStream(const float* const* src, |
522 size_t samples_per_channel, | 500 size_t samples_per_channel, |
523 int input_sample_rate_hz, | 501 int input_sample_rate_hz, |
524 ChannelLayout input_layout, | 502 ChannelLayout input_layout, |
525 int output_sample_rate_hz, | 503 int output_sample_rate_hz, |
526 ChannelLayout output_layout, | 504 ChannelLayout output_layout, |
527 float* const* dest) { | 505 float* const* dest) { |
528 CriticalSectionScoped crit_scoped(crit_); | 506 CriticalSectionScoped crit_scoped(crit_); |
529 StreamConfig input_stream = api_format_.input_stream(); | 507 StreamConfig input_stream = api_format_.input_stream(); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 } | 882 } |
905 | 883 |
906 bool AudioProcessingImpl::was_stream_delay_set() const { | 884 bool AudioProcessingImpl::was_stream_delay_set() const { |
907 return was_stream_delay_set_; | 885 return was_stream_delay_set_; |
908 } | 886 } |
909 | 887 |
910 void AudioProcessingImpl::set_stream_key_pressed(bool key_pressed) { | 888 void AudioProcessingImpl::set_stream_key_pressed(bool key_pressed) { |
911 key_pressed_ = key_pressed; | 889 key_pressed_ = key_pressed; |
912 } | 890 } |
913 | 891 |
914 bool AudioProcessingImpl::stream_key_pressed() const { | |
915 return key_pressed_; | |
916 } | |
917 | |
918 void AudioProcessingImpl::set_delay_offset_ms(int offset) { | 892 void AudioProcessingImpl::set_delay_offset_ms(int offset) { |
919 CriticalSectionScoped crit_scoped(crit_); | 893 CriticalSectionScoped crit_scoped(crit_); |
920 delay_offset_ms_ = offset; | 894 delay_offset_ms_ = offset; |
921 } | 895 } |
922 | 896 |
923 int AudioProcessingImpl::delay_offset_ms() const { | 897 int AudioProcessingImpl::delay_offset_ms() const { |
924 return delay_offset_ms_; | 898 return delay_offset_ms_; |
925 } | 899 } |
926 | 900 |
927 int AudioProcessingImpl::StartDebugRecording( | 901 int AudioProcessingImpl::StartDebugRecording( |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 int err = WriteMessageToDebugFile(); | 1225 int err = WriteMessageToDebugFile(); |
1252 if (err != kNoError) { | 1226 if (err != kNoError) { |
1253 return err; | 1227 return err; |
1254 } | 1228 } |
1255 | 1229 |
1256 return kNoError; | 1230 return kNoError; |
1257 } | 1231 } |
1258 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1232 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1259 | 1233 |
1260 } // namespace webrtc | 1234 } // namespace webrtc |
OLD | NEW |