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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 if (err != kNoError) { \ | 56 if (err != kNoError) { \ |
| 57 return err; \ | 57 return err; \ |
| 58 } \ | 58 } \ |
| 59 } while (0) | 59 } while (0) |
| 60 | 60 |
| 61 namespace webrtc { | 61 namespace webrtc { |
| 62 | 62 |
| 63 const int AudioProcessing::kNativeSampleRatesHz[] = { | 63 const int AudioProcessing::kNativeSampleRatesHz[] = { |
| 64 AudioProcessing::kSampleRate8kHz, | 64 AudioProcessing::kSampleRate8kHz, |
| 65 AudioProcessing::kSampleRate16kHz, | 65 AudioProcessing::kSampleRate16kHz, |
| 66 #ifdef WEBRTC_ARCH_ARM_FAMILY | |
| 67 AudioProcessing::kSampleRate32kHz}; | |
| 68 #else | |
| 69 AudioProcessing::kSampleRate32kHz, | 66 AudioProcessing::kSampleRate32kHz, |
| 70 AudioProcessing::kSampleRate48kHz}; | 67 AudioProcessing::kSampleRate48kHz}; |
| 71 #endif // WEBRTC_ARCH_ARM_FAMILY | |
| 72 const size_t AudioProcessing::kNumNativeSampleRates = | 68 const size_t AudioProcessing::kNumNativeSampleRates = |
| 73 arraysize(AudioProcessing::kNativeSampleRatesHz); | 69 arraysize(AudioProcessing::kNativeSampleRatesHz); |
| 74 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: | 70 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: |
| 75 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; | 71 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; |
| 76 | 72 |
| 77 namespace { | 73 namespace { |
| 78 | 74 |
| 75 const int kInternalNativeRates[] = {AudioProcessing::kSampleRate8kHz, | |
| 76 AudioProcessing::kSampleRate16kHz, | |
| 77 #ifdef WEBRTC_ARCH_ARM_FAMILY | |
| 78 AudioProcessing::kSampleRate32kHz}; | |
| 79 #else | |
| 80 AudioProcessing::kSampleRate32kHz, | |
| 81 AudioProcessing::kSampleRate48kHz}; | |
| 82 #endif // WEBRTC_ARCH_ARM_FAMILY | |
| 83 | |
| 79 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { | 84 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { |
| 80 switch (layout) { | 85 switch (layout) { |
| 81 case AudioProcessing::kMono: | 86 case AudioProcessing::kMono: |
| 82 case AudioProcessing::kStereo: | 87 case AudioProcessing::kStereo: |
| 83 return false; | 88 return false; |
| 84 case AudioProcessing::kMonoAndKeyboard: | 89 case AudioProcessing::kMonoAndKeyboard: |
| 85 case AudioProcessing::kStereoAndKeyboard: | 90 case AudioProcessing::kStereoAndKeyboard: |
| 86 return true; | 91 return true; |
| 87 } | 92 } |
| 88 | 93 |
| 89 assert(false); | 94 assert(false); |
| 90 return false; | 95 return false; |
| 91 } | 96 } |
| 92 | 97 |
| 93 bool is_multi_band(int sample_rate_hz) { | 98 bool is_multi_band(int sample_rate_hz) { |
| 94 return sample_rate_hz == AudioProcessing::kSampleRate32kHz || | 99 return sample_rate_hz == AudioProcessing::kSampleRate32kHz || |
| 95 sample_rate_hz == AudioProcessing::kSampleRate48kHz; | 100 sample_rate_hz == AudioProcessing::kSampleRate48kHz; |
| 96 } | 101 } |
| 97 | 102 |
| 98 int ClosestHigherNativeRate(int min_proc_rate) { | 103 int ClosestHigherNativeRate(int min_proc_rate) { |
| 99 for (int rate : AudioProcessing::kNativeSampleRatesHz) { | 104 int max_native_rate = kInternalNativeRates[0]; |
| 105 for (int rate : kInternalNativeRates) { | |
| 100 if (rate >= min_proc_rate) { | 106 if (rate >= min_proc_rate) { |
| 101 return rate; | 107 return rate; |
| 102 } | 108 } |
| 109 max_native_rate = rate; | |
| 103 } | 110 } |
| 104 return AudioProcessing::kMaxNativeSampleRateHz; | 111 return max_native_rate; |
|
hlundin-webrtc
2016/08/23 07:41:47
return kInternalNativeRates[arraysize(kInternalNat
| |
| 105 } | 112 } |
| 106 | 113 |
| 107 } // namespace | 114 } // namespace |
| 108 | 115 |
| 109 // Throughout webrtc, it's assumed that success is represented by zero. | 116 // Throughout webrtc, it's assumed that success is represented by zero. |
| 110 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); | 117 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); |
| 111 | 118 |
| 112 struct AudioProcessingImpl::ApmPublicSubmodules { | 119 struct AudioProcessingImpl::ApmPublicSubmodules { |
| 113 ApmPublicSubmodules() {} | 120 ApmPublicSubmodules() {} |
| 114 // Accessed externally of APM without any lock acquired. | 121 // Accessed externally of APM without any lock acquired. |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1492 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); | 1499 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); |
| 1493 | 1500 |
| 1494 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 1501 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
| 1495 &debug_dump_.num_bytes_left_for_log_, | 1502 &debug_dump_.num_bytes_left_for_log_, |
| 1496 &crit_debug_, &debug_dump_.capture)); | 1503 &crit_debug_, &debug_dump_.capture)); |
| 1497 return kNoError; | 1504 return kNoError; |
| 1498 } | 1505 } |
| 1499 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1506 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
| 1500 | 1507 |
| 1501 } // namespace webrtc | 1508 } // namespace webrtc |
| OLD | NEW |