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 |
11 #include "webrtc/modules/audio_processing/audio_buffer.h" | 11 #include "webrtc/modules/audio_processing/audio_buffer.h" |
12 | 12 |
13 #include "webrtc/common_audio/include/audio_util.h" | 13 #include "webrtc/common_audio/include/audio_util.h" |
14 #include "webrtc/common_audio/resampler/push_sinc_resampler.h" | 14 #include "webrtc/common_audio/resampler/push_sinc_resampler.h" |
15 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 15 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
16 #include "webrtc/common_audio/channel_buffer.h" | 16 #include "webrtc/common_audio/channel_buffer.h" |
17 #include "webrtc/modules/audio_processing/common.h" | 17 #include "webrtc/modules/audio_processing/common.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 namespace { | 20 namespace { |
21 | 21 |
22 const size_t kSamplesPer16kHzChannel = 160; | 22 const size_t kSamplesPer16kHzChannel = 160; |
23 const size_t kSamplesPer32kHzChannel = 320; | 23 const size_t kSamplesPer32kHzChannel = 320; |
24 const size_t kSamplesPer48kHzChannel = 480; | 24 const size_t kSamplesPer48kHzChannel = 480; |
25 | 25 |
26 int KeyboardChannelIndex(const StreamConfig& stream_config) { | 26 int KeyboardChannelIndex(const StreamConfig& stream_config) { |
27 if (!stream_config.has_keyboard()) { | 27 if (!stream_config.has_keyboard()) { |
28 assert(false); | 28 assert(false); |
29 return -1; | 29 return 0; |
30 } | 30 } |
31 | 31 |
32 return stream_config.num_channels(); | 32 return stream_config.num_channels(); |
33 } | 33 } |
34 | 34 |
35 size_t NumBandsFromSamplesPerChannel(size_t num_frames) { | 35 size_t NumBandsFromSamplesPerChannel(size_t num_frames) { |
36 size_t num_bands = 1; | 36 size_t num_bands = 1; |
37 if (num_frames == kSamplesPer32kHzChannel || | 37 if (num_frames == kSamplesPer32kHzChannel || |
38 num_frames == kSamplesPer48kHzChannel) { | 38 num_frames == kSamplesPer48kHzChannel) { |
39 num_bands = rtc::CheckedDivExact(num_frames, kSamplesPer16kHzChannel); | 39 num_bands = rtc::CheckedDivExact(num_frames, kSamplesPer16kHzChannel); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 453 |
454 void AudioBuffer::SplitIntoFrequencyBands() { | 454 void AudioBuffer::SplitIntoFrequencyBands() { |
455 splitting_filter_->Analysis(data_.get(), split_data_.get()); | 455 splitting_filter_->Analysis(data_.get(), split_data_.get()); |
456 } | 456 } |
457 | 457 |
458 void AudioBuffer::MergeFrequencyBands() { | 458 void AudioBuffer::MergeFrequencyBands() { |
459 splitting_filter_->Synthesis(split_data_.get(), data_.get()); | 459 splitting_filter_->Synthesis(split_data_.get(), data_.get()); |
460 } | 460 } |
461 | 461 |
462 } // namespace webrtc | 462 } // namespace webrtc |
OLD | NEW |