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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } // namespace audioproc | 47 } // namespace audioproc |
48 #endif | 48 #endif |
49 | 49 |
50 class AudioRate { | 50 class AudioRate { |
51 public: | 51 public: |
52 explicit AudioRate(int sample_rate_hz) { set(sample_rate_hz); } | 52 explicit AudioRate(int sample_rate_hz) { set(sample_rate_hz); } |
53 virtual ~AudioRate() {} | 53 virtual ~AudioRate() {} |
54 | 54 |
55 void set(int rate) { | 55 void set(int rate) { |
56 rate_ = rate; | 56 rate_ = rate; |
57 samples_per_channel_ = AudioProcessing::kChunkSizeMs * rate_ / 1000; | 57 samples_per_channel_ = |
| 58 static_cast<size_t>(AudioProcessing::kChunkSizeMs * rate_ / 1000); |
58 } | 59 } |
59 | 60 |
60 int rate() const { return rate_; } | 61 int rate() const { return rate_; } |
61 int samples_per_channel() const { return samples_per_channel_; } | 62 size_t samples_per_channel() const { return samples_per_channel_; } |
62 | 63 |
63 private: | 64 private: |
64 int rate_; | 65 int rate_; |
65 int samples_per_channel_; | 66 size_t samples_per_channel_; |
66 }; | 67 }; |
67 | 68 |
68 class AudioFormat : public AudioRate { | 69 class AudioFormat : public AudioRate { |
69 public: | 70 public: |
70 AudioFormat(int sample_rate_hz, int num_channels) | 71 AudioFormat(int sample_rate_hz, int num_channels) |
71 : AudioRate(sample_rate_hz), | 72 : AudioRate(sample_rate_hz), |
72 num_channels_(num_channels) {} | 73 num_channels_(num_channels) {} |
73 virtual ~AudioFormat() {} | 74 virtual ~AudioFormat() {} |
74 | 75 |
75 void set(int rate, int num_channels) { | 76 void set(int rate, int num_channels) { |
(...skipping 29 matching lines...) Expand all Loading... |
105 int sample_rate_hz() const override; | 106 int sample_rate_hz() const override; |
106 int proc_sample_rate_hz() const override; | 107 int proc_sample_rate_hz() const override; |
107 int proc_split_sample_rate_hz() const override; | 108 int proc_split_sample_rate_hz() const override; |
108 int num_input_channels() const override; | 109 int num_input_channels() const override; |
109 int num_output_channels() const override; | 110 int num_output_channels() const override; |
110 int num_reverse_channels() const override; | 111 int num_reverse_channels() const override; |
111 void set_output_will_be_muted(bool muted) override; | 112 void set_output_will_be_muted(bool muted) override; |
112 bool output_will_be_muted() const override; | 113 bool output_will_be_muted() const override; |
113 int ProcessStream(AudioFrame* frame) override; | 114 int ProcessStream(AudioFrame* frame) override; |
114 int ProcessStream(const float* const* src, | 115 int ProcessStream(const float* const* src, |
115 int samples_per_channel, | 116 size_t samples_per_channel, |
116 int input_sample_rate_hz, | 117 int input_sample_rate_hz, |
117 ChannelLayout input_layout, | 118 ChannelLayout input_layout, |
118 int output_sample_rate_hz, | 119 int output_sample_rate_hz, |
119 ChannelLayout output_layout, | 120 ChannelLayout output_layout, |
120 float* const* dest) override; | 121 float* const* dest) override; |
121 int AnalyzeReverseStream(AudioFrame* frame) override; | 122 int AnalyzeReverseStream(AudioFrame* frame) override; |
122 int AnalyzeReverseStream(const float* const* data, | 123 int AnalyzeReverseStream(const float* const* data, |
123 int samples_per_channel, | 124 size_t samples_per_channel, |
124 int sample_rate_hz, | 125 int sample_rate_hz, |
125 ChannelLayout layout) override; | 126 ChannelLayout layout) override; |
126 int set_stream_delay_ms(int delay) override; | 127 int set_stream_delay_ms(int delay) override; |
127 int stream_delay_ms() const override; | 128 int stream_delay_ms() const override; |
128 bool was_stream_delay_set() const override; | 129 bool was_stream_delay_set() const override; |
129 void set_delay_offset_ms(int offset) override; | 130 void set_delay_offset_ms(int offset) override; |
130 int delay_offset_ms() const override; | 131 int delay_offset_ms() const override; |
131 void set_stream_key_pressed(bool key_pressed) override; | 132 void set_stream_key_pressed(bool key_pressed) override; |
132 bool stream_key_pressed() const override; | 133 bool stream_key_pressed() const override; |
133 int StartDebugRecording(const char filename[kMaxFilenameSize]) override; | 134 int StartDebugRecording(const char filename[kMaxFilenameSize]) override; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const bool beamformer_enabled_; | 229 const bool beamformer_enabled_; |
229 rtc::scoped_ptr<Beamformer<float>> beamformer_; | 230 rtc::scoped_ptr<Beamformer<float>> beamformer_; |
230 const std::vector<Point> array_geometry_; | 231 const std::vector<Point> array_geometry_; |
231 | 232 |
232 const bool supports_48kHz_; | 233 const bool supports_48kHz_; |
233 }; | 234 }; |
234 | 235 |
235 } // namespace webrtc | 236 } // namespace webrtc |
236 | 237 |
237 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ | 238 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AUDIO_PROCESSING_IMPL_H_ |
OLD | NEW |