Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 5 #ifndef MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
| 6 #define MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 6 #define MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 // Constructs a MultiChannelResampler with the specified |read_cb|, which is | 27 // Constructs a MultiChannelResampler with the specified |read_cb|, which is |
| 28 // used to acquire audio data for resampling. |io_sample_rate_ratio| is the | 28 // used to acquire audio data for resampling. |io_sample_rate_ratio| is the |
| 29 // ratio of input / output sample rates. | 29 // ratio of input / output sample rates. |
| 30 MultiChannelResampler(int channels, double io_sample_rate_ratio, | 30 MultiChannelResampler(int channels, double io_sample_rate_ratio, |
| 31 const ReadCB& read_cb); | 31 const ReadCB& read_cb); |
| 32 virtual ~MultiChannelResampler(); | 32 virtual ~MultiChannelResampler(); |
| 33 | 33 |
| 34 // Resamples |frames| of data from |read_cb_| into AudioBus. | 34 // Resamples |frames| of data from |read_cb_| into AudioBus. |
| 35 void Resample(AudioBus* audio_bus, int frames); | 35 void Resample(AudioBus* audio_bus, int frames); |
| 36 | 36 |
| 37 // Flush all buffered data and reset internal indexes. | |
|
scherkus (not reviewing)
2012/09/07 13:30:17
s/indexes/indicies/
$ git grep -i "indexes" . | w
DaleCurtis
2012/09/10 12:06:24
Done.
| |
| 38 void Flush(); | |
| 39 | |
| 37 private: | 40 private: |
| 41 friend class MultiChannelResamplerTest; | |
|
scherkus (not reviewing)
2012/09/07 13:30:17
hrmm.. friend only for last_frame_count_?
I'd eit
DaleCurtis
2012/09/10 12:06:24
Removed.
| |
| 42 | |
| 38 // SincResampler::ReadCB implementation. ProvideInput() will be called for | 43 // SincResampler::ReadCB implementation. ProvideInput() will be called for |
| 39 // each channel (in channel order) as SincResampler needs more data. | 44 // each channel (in channel order) as SincResampler needs more data. |
| 40 void ProvideInput(int channel, float* destination, int frames); | 45 void ProvideInput(int channel, float* destination, int frames); |
| 41 | 46 |
| 42 // Sanity check to ensure that ProvideInput() retrieves the same number of | 47 // Sanity check to ensure that ProvideInput() retrieves the same number of |
| 43 // frames for every channel. | 48 // frames for every channel. |
| 44 int last_frame_count_; | 49 int last_frame_count_; |
| 45 | 50 |
| 46 // Source of data for resampling. | 51 // Source of data for resampling. |
| 47 ReadCB read_cb_; | 52 ReadCB read_cb_; |
| 48 | 53 |
| 49 // Each channel has its own high quality resampler. | 54 // Each channel has its own high quality resampler. |
| 50 ScopedVector<SincResampler> resamplers_; | 55 ScopedVector<SincResampler> resamplers_; |
| 51 | 56 |
| 52 // Buffers for audio data going into SincResampler from ReadCB. | 57 // Buffers for audio data going into SincResampler from ReadCB. |
| 53 scoped_ptr<AudioBus> resampler_audio_bus_; | 58 scoped_ptr<AudioBus> resampler_audio_bus_; |
| 54 scoped_ptr<AudioBus> wrapped_resampler_audio_bus_; | 59 scoped_ptr<AudioBus> wrapped_resampler_audio_bus_; |
| 55 std::vector<float*> resampler_audio_data_; | 60 std::vector<float*> resampler_audio_data_; |
| 56 }; | 61 }; |
| 57 | 62 |
| 58 } // namespace media | 63 } // namespace media |
| 59 | 64 |
| 60 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 65 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
| OLD | NEW |