OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "services/media/audio/audio_track_impl.h" | 9 #include "services/media/audio/audio_track_impl.h" |
10 #include "services/media/audio/platform/generic/mixers/mixer_utils.h" | 10 #include "services/media/audio/platform/generic/mixers/mixer_utils.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 src, frac_src_frames, frac_src_offset, | 159 src, frac_src_frames, frac_src_offset, |
160 frac_step_size, amplitude_scale); | 160 frac_step_size, amplitude_scale); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 // Templates used to expand all of the different combinations of the possible | 164 // Templates used to expand all of the different combinations of the possible |
165 // Point Sampler Mixer configurations. | 165 // Point Sampler Mixer configurations. |
166 template <size_t DChCount, | 166 template <size_t DChCount, |
167 typename SType, | 167 typename SType, |
168 size_t SChCount> | 168 size_t SChCount> |
169 static inline MixerPtr SelectPSM(const LpcmMediaTypeDetailsPtr& src_format, | 169 static inline MixerPtr SelectPSM(const AudioMediaTypeDetailsPtr& src_format, |
170 const LpcmMediaTypeDetailsPtr& dst_format) { | 170 const AudioMediaTypeDetailsPtr& dst_format) { |
171 return MixerPtr(new PointSamplerImpl<DChCount, SType, SChCount>()); | 171 return MixerPtr(new PointSamplerImpl<DChCount, SType, SChCount>()); |
172 } | 172 } |
173 | 173 |
174 template <size_t DChCount, | 174 template <size_t DChCount, |
175 typename SType> | 175 typename SType> |
176 static inline MixerPtr SelectPSM(const LpcmMediaTypeDetailsPtr& src_format, | 176 static inline MixerPtr SelectPSM(const AudioMediaTypeDetailsPtr& src_format, |
177 const LpcmMediaTypeDetailsPtr& dst_format) { | 177 const AudioMediaTypeDetailsPtr& dst_format) { |
178 switch (src_format->channels) { | 178 switch (src_format->channels) { |
179 case 1: | 179 case 1: |
180 return SelectPSM<DChCount, SType, 1>(src_format, dst_format); | 180 return SelectPSM<DChCount, SType, 1>(src_format, dst_format); |
181 case 2: | 181 case 2: |
182 return SelectPSM<DChCount, SType, 2>(src_format, dst_format); | 182 return SelectPSM<DChCount, SType, 2>(src_format, dst_format); |
183 default: | 183 default: |
184 return nullptr; | 184 return nullptr; |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 template <size_t DChCount> | 188 template <size_t DChCount> |
189 static inline MixerPtr SelectPSM(const LpcmMediaTypeDetailsPtr& src_format, | 189 static inline MixerPtr SelectPSM(const AudioMediaTypeDetailsPtr& src_format, |
190 const LpcmMediaTypeDetailsPtr& dst_format) { | 190 const AudioMediaTypeDetailsPtr& dst_format) { |
191 switch (src_format->sample_format) { | 191 switch (src_format->sample_format) { |
192 case LpcmSampleFormat::UNSIGNED_8: | 192 case AudioSampleFormat::UNSIGNED_8: |
193 return SelectPSM<DChCount, uint8_t>(src_format, dst_format); | 193 return SelectPSM<DChCount, uint8_t>(src_format, dst_format); |
194 case LpcmSampleFormat::SIGNED_16: | 194 case AudioSampleFormat::SIGNED_16: |
195 return SelectPSM<DChCount, int16_t>(src_format, dst_format); | 195 return SelectPSM<DChCount, int16_t>(src_format, dst_format); |
196 default: | 196 default: |
197 return nullptr; | 197 return nullptr; |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 MixerPtr PointSampler::Select(const LpcmMediaTypeDetailsPtr& src_format, | 201 MixerPtr PointSampler::Select(const AudioMediaTypeDetailsPtr& src_format, |
202 const LpcmMediaTypeDetailsPtr& dst_format) { | 202 const AudioMediaTypeDetailsPtr& dst_format) { |
203 switch (dst_format->channels) { | 203 switch (dst_format->channels) { |
204 case 1: | 204 case 1: |
205 return SelectPSM<1>(src_format, dst_format); | 205 return SelectPSM<1>(src_format, dst_format); |
206 case 2: | 206 case 2: |
207 return SelectPSM<2>(src_format, dst_format); | 207 return SelectPSM<2>(src_format, dst_format); |
208 default: | 208 default: |
209 return nullptr; | 209 return nullptr; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 } // namespace mixers | 213 } // namespace mixers |
214 } // namespace audio | 214 } // namespace audio |
215 } // namespace media | 215 } // namespace media |
216 } // namespace mojo | 216 } // namespace mojo |
OLD | NEW |