Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1678)

Unified Diff: media/base/multi_channel_resampler.h

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup MCR AudioBus usage. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/fake_audio_render_callback.cc ('k') | media/base/multi_channel_resampler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/multi_channel_resampler.h
diff --git a/media/base/multi_channel_resampler.h b/media/base/multi_channel_resampler.h
index db95bc52776273168fb158020507885c47877556..6d65075241df18d052a59158c850f843c6bbcbf8 100644
--- a/media/base/multi_channel_resampler.h
+++ b/media/base/multi_channel_resampler.h
@@ -13,16 +13,16 @@
#include "media/base/sinc_resampler.h"
namespace media {
+class AudioBus;
// MultiChannelResampler is a multi channel wrapper for SincResampler; allowing
// high quality sample rate conversion of multiple channels at once.
class MEDIA_EXPORT MultiChannelResampler {
public:
- // Callback type for providing more data into the resampler. Expects |frames|
- // of data for all channels to be rendered into |destination|; zero padded if
- // not enough frames are available to satisfy the request.
- typedef base::Callback<void(const std::vector<float*>& destination,
- int frames)> ReadCB;
+ // Callback type for providing more data into the resampler. Expects AudioBus
+ // to be completely filled with data upon return; zero padded if not enough
+ // frames are available to satisfy the request.
+ typedef base::Callback<void(AudioBus* audio_bus)> ReadCB;
// Constructs a MultiChannelResampler with the specified |read_cb|, which is
// used to acquire audio data for resampling. |io_sample_rate_ratio| is the
@@ -31,8 +31,8 @@ class MEDIA_EXPORT MultiChannelResampler {
const ReadCB& read_cb);
virtual ~MultiChannelResampler();
- // Resample |frames| of data from |read_cb_| into |destination|.
- void Resample(const std::vector<float*>& destination, int frames);
+ // Resamples |frames| of data from |read_cb_| into AudioBus.
+ void Resample(AudioBus* audio_bus, int frames);
private:
// SincResampler::ReadCB implementation. ProvideInput() will be called for
@@ -43,17 +43,15 @@ class MEDIA_EXPORT MultiChannelResampler {
// frames for every channel.
int last_frame_count_;
- // Sanity check to ensure |resampler_audio_data_| is properly allocated.
- int first_frame_count_;
-
// Source of data for resampling.
ReadCB read_cb_;
// Each channel has its own high quality resampler.
ScopedVector<SincResampler> resamplers_;
- // Buffer for audio data going into SincResampler from ReadCB. Owned by this
- // class and only temporarily passed out to ReadCB when data is required.
+ // Buffers for audio data going into SincResampler from ReadCB.
+ scoped_ptr<AudioBus> resampler_audio_bus_;
+ scoped_ptr<AudioBus> wrapped_resampler_audio_bus_;
std::vector<float*> resampler_audio_data_;
};
« no previous file with comments | « media/base/fake_audio_render_callback.cc ('k') | media/base/multi_channel_resampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698