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

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

Issue 2265473003: Removed the global limitation of the native sample rates on ARM devices and replaced it with an APM… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase and changes in response to reviewer comments Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (err != kNoError) { \ 66 if (err != kNoError) { \
67 return err; \ 67 return err; \
68 } \ 68 } \
69 } while (0) 69 } while (0)
70 70
71 namespace webrtc { 71 namespace webrtc {
72 72
73 const int AudioProcessing::kNativeSampleRatesHz[] = { 73 const int AudioProcessing::kNativeSampleRatesHz[] = {
74 AudioProcessing::kSampleRate8kHz, 74 AudioProcessing::kSampleRate8kHz,
75 AudioProcessing::kSampleRate16kHz, 75 AudioProcessing::kSampleRate16kHz,
76 #ifdef WEBRTC_ARCH_ARM_FAMILY
77 AudioProcessing::kSampleRate32kHz};
78 #else
79 AudioProcessing::kSampleRate32kHz, 76 AudioProcessing::kSampleRate32kHz,
80 AudioProcessing::kSampleRate48kHz}; 77 AudioProcessing::kSampleRate48kHz};
81 #endif // WEBRTC_ARCH_ARM_FAMILY
82 const size_t AudioProcessing::kNumNativeSampleRates = 78 const size_t AudioProcessing::kNumNativeSampleRates =
83 arraysize(AudioProcessing::kNativeSampleRatesHz); 79 arraysize(AudioProcessing::kNativeSampleRatesHz);
84 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: 80 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing::
85 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; 81 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1];
86 82
87 namespace { 83 namespace {
88 84
85 const int kInternalNativeRates[] = {AudioProcessing::kSampleRate8kHz,
86 AudioProcessing::kSampleRate16kHz,
87 #ifdef WEBRTC_ARCH_ARM_FAMILY
88 AudioProcessing::kSampleRate32kHz};
89 #else
90 AudioProcessing::kSampleRate32kHz,
91 AudioProcessing::kSampleRate48kHz};
92 #endif // WEBRTC_ARCH_ARM_FAMILY
93
89 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { 94 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) {
90 switch (layout) { 95 switch (layout) {
91 case AudioProcessing::kMono: 96 case AudioProcessing::kMono:
92 case AudioProcessing::kStereo: 97 case AudioProcessing::kStereo:
93 return false; 98 return false;
94 case AudioProcessing::kMonoAndKeyboard: 99 case AudioProcessing::kMonoAndKeyboard:
95 case AudioProcessing::kStereoAndKeyboard: 100 case AudioProcessing::kStereoAndKeyboard:
96 return true; 101 return true;
97 } 102 }
98 103
99 assert(false); 104 assert(false);
100 return false; 105 return false;
101 } 106 }
102 107
103 bool is_multi_band(int sample_rate_hz) { 108 bool is_multi_band(int sample_rate_hz) {
104 return sample_rate_hz == AudioProcessing::kSampleRate32kHz || 109 return sample_rate_hz == AudioProcessing::kSampleRate32kHz ||
105 sample_rate_hz == AudioProcessing::kSampleRate48kHz; 110 sample_rate_hz == AudioProcessing::kSampleRate48kHz;
106 } 111 }
107 112
108 int ClosestHigherNativeRate(int min_proc_rate) { 113 int ClosestHigherNativeRate(int min_proc_rate) {
109 for (int rate : AudioProcessing::kNativeSampleRatesHz) { 114 for (int rate : kInternalNativeRates) {
110 if (rate >= min_proc_rate) { 115 if (rate >= min_proc_rate) {
111 return rate; 116 return rate;
112 } 117 }
113 } 118 }
114 return AudioProcessing::kMaxNativeSampleRateHz; 119 return kInternalNativeRates[arraysize(kInternalNativeRates) - 1];
115 } 120 }
116 121
117 } // namespace 122 } // namespace
118 123
119 // Throughout webrtc, it's assumed that success is represented by zero. 124 // Throughout webrtc, it's assumed that success is represented by zero.
120 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); 125 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero");
121 126
122 struct AudioProcessingImpl::ApmPublicSubmodules { 127 struct AudioProcessingImpl::ApmPublicSubmodules {
123 ApmPublicSubmodules() {} 128 ApmPublicSubmodules() {}
124 // Accessed externally of APM without any lock acquired. 129 // Accessed externally of APM without any lock acquired.
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 fwd_proc_format(kSampleRate16kHz), 1561 fwd_proc_format(kSampleRate16kHz),
1557 split_rate(kSampleRate16kHz) {} 1562 split_rate(kSampleRate16kHz) {}
1558 1563
1559 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1564 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1560 1565
1561 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1566 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1562 1567
1563 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1568 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1564 1569
1565 } // namespace webrtc 1570 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698