| 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 17 matching lines...) Expand all Loading... |
| 28 // Constructs a MultiChannelResampler with the specified |read_cb|, which is | 28 // Constructs a MultiChannelResampler with the specified |read_cb|, which is |
| 29 // used to acquire audio data for resampling. |io_sample_rate_ratio| is the | 29 // used to acquire audio data for resampling. |io_sample_rate_ratio| is the |
| 30 // ratio of input / output sample rates. |request_frames| is the size in | 30 // ratio of input / output sample rates. |request_frames| is the size in |
| 31 // frames of the AudioBus to be filled by |read_cb|. | 31 // frames of the AudioBus to be filled by |read_cb|. |
| 32 MultiChannelResampler(int channels, | 32 MultiChannelResampler(int channels, |
| 33 double io_sample_rate_ratio, | 33 double io_sample_rate_ratio, |
| 34 size_t request_frames, | 34 size_t request_frames, |
| 35 const ReadCB& read_cb); | 35 const ReadCB& read_cb); |
| 36 virtual ~MultiChannelResampler(); | 36 virtual ~MultiChannelResampler(); |
| 37 | 37 |
| 38 void PrimeWithSilence(); |
| 39 |
| 38 // Resamples |frames| of data from |read_cb_| into AudioBus. | 40 // Resamples |frames| of data from |read_cb_| into AudioBus. |
| 39 void Resample(int frames, AudioBus* audio_bus); | 41 void Resample(int frames, AudioBus* audio_bus); |
| 40 | 42 |
| 41 // Flush all buffered data and reset internal indices. Not thread safe, do | 43 // Flush all buffered data and reset internal indices. Not thread safe, do |
| 42 // not call while Resample() is in progress. | 44 // not call while Resample() is in progress. |
| 43 void Flush(); | 45 void Flush(); |
| 44 | 46 |
| 45 // Update ratio for all SincResamplers. SetRatio() will cause reconstruction | 47 // Update ratio for all SincResamplers. SetRatio() will cause reconstruction |
| 46 // of the kernels used for resampling. Not thread safe, do not call while | 48 // of the kernels used for resampling. Not thread safe, do not call while |
| 47 // Resample() is in progress. | 49 // Resample() is in progress. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 // The number of output frames that have successfully been processed during | 77 // The number of output frames that have successfully been processed during |
| 76 // the current Resample() call. | 78 // the current Resample() call. |
| 77 int output_frames_ready_; | 79 int output_frames_ready_; |
| 78 | 80 |
| 79 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); | 81 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace media | 84 } // namespace media |
| 83 | 85 |
| 84 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 86 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
| OLD | NEW |