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 11 matching lines...) Expand all Loading... | |
| 22 // Callback type for providing more data into the resampler. Expects AudioBus | 22 // Callback type for providing more data into the resampler. Expects AudioBus |
| 23 // to be completely filled with data upon return; zero padded if not enough | 23 // to be completely filled with data upon return; zero padded if not enough |
| 24 // frames are available to satisfy the request. |frame_delay| is the number | 24 // frames are available to satisfy the request. |frame_delay| is the number |
| 25 // of output frames already processed and can be used to estimate delay. | 25 // of output frames already processed and can be used to estimate delay. |
| 26 typedef base::Callback<void(int frame_delay, AudioBus* audio_bus)> ReadCB; | 26 typedef base::Callback<void(int frame_delay, AudioBus* audio_bus)> ReadCB; |
| 27 | 27 |
| 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. | 30 // ratio of input / output sample rates. |
| 31 MultiChannelResampler(int channels, double io_sample_rate_ratio, | 31 MultiChannelResampler(int channels, double io_sample_rate_ratio, |
| 32 const ReadCB& read_cb); | 32 size_t request_size, const ReadCB& read_cb); |
|
henrika (OOO until Aug 14)
2013/04/27 19:43:40
Perhaps add a comment about the new parameter?
Sergey Ulanov
2013/04/29 06:23:37
nit: one argument per line please: http://www.chro
DaleCurtis
2013/04/29 22:12:31
Renamed to request_frames and added a comment.
| |
| 33 virtual ~MultiChannelResampler(); | 33 virtual ~MultiChannelResampler(); |
| 34 | 34 |
| 35 // Resamples |frames| of data from |read_cb_| into AudioBus. | 35 // Resamples |frames| of data from |read_cb_| into AudioBus. |
| 36 void Resample(AudioBus* audio_bus, int frames); | 36 void Resample(AudioBus* audio_bus, int frames); |
|
Chris Rogers
2013/04/28 19:50:56
Wouldn't it be better to try to get the callback s
Sergey Ulanov
2013/04/29 06:23:37
unrelated nit: output parameters should be after i
DaleCurtis
2013/04/29 18:50:04
Practically I think it amounts to the same thing i
DaleCurtis
2013/04/29 22:12:31
Done.
| |
| 37 | 37 |
| 38 // Flush all buffered data and reset internal indices. Not thread safe, do | 38 // Flush all buffered data and reset internal indices. Not thread safe, do |
| 39 // not call while Resample() is in progress. | 39 // not call while Resample() is in progress. |
| 40 void Flush(); | 40 void Flush(); |
| 41 | 41 |
| 42 // Update ratio for all SincResamplers. SetRatio() will cause reconstruction | 42 // Update ratio for all SincResamplers. SetRatio() will cause reconstruction |
| 43 // of the kernels used for resampling. Not thread safe, do not call while | 43 // of the kernels used for resampling. Not thread safe, do not call while |
| 44 // Resample() is in progress. | 44 // Resample() is in progress. |
| 45 void SetRatio(double io_sample_rate_ratio); | 45 void SetRatio(double io_sample_rate_ratio); |
| 46 | 46 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 67 // The number of output frames that have successfully been processed during | 67 // The number of output frames that have successfully been processed during |
| 68 // the current Resample() call. | 68 // the current Resample() call. |
| 69 int output_frames_ready_; | 69 int output_frames_ready_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); | 71 DISALLOW_COPY_AND_ASSIGN(MultiChannelResampler); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace media | 74 } // namespace media |
| 75 | 75 |
| 76 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ | 76 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ |
| OLD | NEW |