| Index: media/base/sinc_resampler.h
|
| diff --git a/media/base/sinc_resampler.h b/media/base/sinc_resampler.h
|
| index a1d3cf718bbf5982b6933eba385743bf6eb04ad5..95c6096907a8e9d5c4e66ca623a7220b85fcd7ff 100644
|
| --- a/media/base/sinc_resampler.h
|
| +++ b/media/base/sinc_resampler.h
|
| @@ -16,9 +16,30 @@ namespace media {
|
| // SincResampler is a high-quality single-channel sample-rate converter.
|
| class MEDIA_EXPORT SincResampler {
|
| public:
|
| - // The maximum number of samples that may be requested from the callback ahead
|
| - // of the current position in the stream.
|
| - static const int kMaximumLookAheadSize;
|
| + enum {
|
| + // The kernel size can be adjusted for quality (higher is better) at the
|
| + // expense of performance. Must be a multiple of 32.
|
| + // TODO(dalecurtis): Test performance to see if we can jack this up to 64+.
|
| + kKernelSize = 32,
|
| +
|
| + // The number of destination frames generated per processing pass. Affects
|
| + // how often and for how much SincResampler calls back for input. Must be
|
| + // greater than kKernelSize.
|
| + kBlockSize = 512,
|
| +
|
| + // The kernel offset count is used for interpolation and is the number of
|
| + // sub-sample kernel shifts. Can be adjusted for quality (higher is better)
|
| + // at the expense of allocating more memory.
|
| + kKernelOffsetCount = 32,
|
| + kKernelStorageSize = kKernelSize * (kKernelOffsetCount + 1),
|
| +
|
| + // The size (in samples) of the internal buffer used by the resampler.
|
| + kBufferSize = kBlockSize + kKernelSize,
|
| +
|
| + // The maximum number of samples that may be requested from the callback
|
| + // ahead of the current position in the stream.
|
| + kMaximumLookAheadSize = kBufferSize
|
| + };
|
|
|
| // Callback type for providing more data into the resampler. Expects |frames|
|
| // of data to be rendered into |destination|; zero padded if not enough frames
|
| @@ -36,7 +57,7 @@ class MEDIA_EXPORT SincResampler {
|
|
|
| // The maximum size in frames that guarantees Resample() will only make a
|
| // single call to |read_cb_| for more data.
|
| - int ChunkSize();
|
| + int ChunkSize() const;
|
|
|
| // Flush all buffered data and reset internal indices.
|
| void Flush();
|
| @@ -63,7 +84,7 @@ class MEDIA_EXPORT SincResampler {
|
| double kernel_interpolation_factor);
|
|
|
| // The ratio of input / output sample rates.
|
| - double io_sample_rate_ratio_;
|
| + const double io_sample_rate_ratio_;
|
|
|
| // An index on the source input buffer with sub-sample precision. It must be
|
| // double precision to avoid drift.
|
|
|