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

Side by Side Diff: media/base/multi_channel_resampler.h

Issue 11410012: Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First draft. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 19 matching lines...) Expand all
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 indices. 37 // Flush all buffered data and reset internal indices.
38 void Flush(); 38 void Flush();
39 39
40 // Number of output frames already processed. Can be called by ReadCB to
41 // determine the current audio delay due to buffering.
42 int output_frames_ready() { return output_frames_ready_; }
miu 2012/11/12 20:51:59 This appears to be monotonically increasing. The
DaleCurtis 2012/11/12 21:23:53 It is not monotonically increasing. It is reset to
43
40 private: 44 private:
41 // SincResampler::ReadCB implementation. ProvideInput() will be called for 45 // SincResampler::ReadCB implementation. ProvideInput() will be called for
42 // each channel (in channel order) as SincResampler needs more data. 46 // each channel (in channel order) as SincResampler needs more data.
43 void ProvideInput(int channel, float* destination, int frames); 47 void ProvideInput(int channel, float* destination, int frames);
44 48
45 // Sanity check to ensure that ProvideInput() retrieves the same number of 49 // Sanity check to ensure that ProvideInput() retrieves the same number of
46 // frames for every channel. 50 // frames for every channel.
47 int last_frame_count_; 51 int last_frame_count_;
48 52
49 // Source of data for resampling. 53 // Source of data for resampling.
50 ReadCB read_cb_; 54 ReadCB read_cb_;
51 55
52 // Each channel has its own high quality resampler. 56 // Each channel has its own high quality resampler.
53 ScopedVector<SincResampler> resamplers_; 57 ScopedVector<SincResampler> resamplers_;
54 58
55 // Buffers for audio data going into SincResampler from ReadCB. 59 // Buffers for audio data going into SincResampler from ReadCB.
56 scoped_ptr<AudioBus> resampler_audio_bus_; 60 scoped_ptr<AudioBus> resampler_audio_bus_;
57 scoped_ptr<AudioBus> wrapped_resampler_audio_bus_; 61 scoped_ptr<AudioBus> wrapped_resampler_audio_bus_;
58 std::vector<float*> resampler_audio_data_; 62 std::vector<float*> resampler_audio_data_;
63
64 // The number of output frames that have successfully been processed during
65 // the current Resample() call.
66 int output_frames_ready_;
59 }; 67 };
scherkus (not reviewing) 2012/11/14 22:43:50 missing DISALLOW_...
DaleCurtis 2012/11/16 23:51:05 Done.
60 68
61 } // namespace media 69 } // namespace media
62 70
63 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_ 71 #endif // MEDIA_BASE_MULTI_CHANNEL_RESAMPLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698