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

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

Issue 10698066: Switch to pcm_low_latency and enable resampling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments! Remove RefCount. Squash ARMM changes. Created 8 years, 5 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 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_AUDIO_RENDERER_MIXER_INPUT_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h"
10 #include "media/base/audio_renderer_sink.h" 11 #include "media/base/audio_renderer_sink.h"
11 12
12 namespace media { 13 namespace media {
13 14
14 class AudioRendererMixer; 15 class AudioRendererMixer;
15 16
16 class MEDIA_EXPORT AudioRendererMixerInput 17 class MEDIA_EXPORT AudioRendererMixerInput
17 : NON_EXPORTED_BASE(public AudioRendererSink) { 18 : NON_EXPORTED_BASE(public AudioRendererSink) {
18 public: 19 public:
19 explicit AudioRendererMixerInput( 20 typedef base::Callback<AudioRendererMixer*(
20 const scoped_refptr<AudioRendererMixer>& mixer); 21 const AudioParameters& params)> GetMixerCB;
22 typedef base::Callback<void(const AudioParameters& params)> RemoveMixerCB;
23 AudioRendererMixerInput(
scherkus (not reviewing) 2012/07/14 01:45:02 nit: blank line before here
DaleCurtis 2012/07/14 02:10:03 Done.
24 const GetMixerCB& get_mixer_cb, const RemoveMixerCB& remove_mixer_cb);
21 25
22 // Each input should manage its own data buffer. The mixer will call this
23 // method when it needs a buffer for rendering.
24 const std::vector<float*>& audio_data() { return audio_data_; }
25 AudioRendererSink::RenderCallback* callback() { return callback_; } 26 AudioRendererSink::RenderCallback* callback() { return callback_; }
26 bool playing() { return playing_; } 27 bool playing() { return playing_; }
27 28
28 // AudioRendererSink implementation. 29 // AudioRendererSink implementation.
29 virtual void Start() OVERRIDE; 30 virtual void Start() OVERRIDE;
30 virtual void Stop() OVERRIDE; 31 virtual void Stop() OVERRIDE;
31 virtual void Play() OVERRIDE; 32 virtual void Play() OVERRIDE;
32 virtual void Pause(bool flush) OVERRIDE; 33 virtual void Pause(bool flush) OVERRIDE;
33 virtual bool SetVolume(double volume) OVERRIDE; 34 virtual bool SetVolume(double volume) OVERRIDE;
34 virtual void GetVolume(double* volume) OVERRIDE; 35 virtual void GetVolume(double* volume) OVERRIDE;
35 virtual void Initialize(const AudioParameters& params, 36 virtual void Initialize(const AudioParameters& params,
36 AudioRendererSink::RenderCallback* renderer) OVERRIDE; 37 AudioRendererSink::RenderCallback* renderer) OVERRIDE;
37 38
38 protected: 39 protected:
39 virtual ~AudioRendererMixerInput(); 40 virtual ~AudioRendererMixerInput();
40 41
41 private: 42 private:
42 bool playing_; 43 bool playing_;
43 bool initialized_; 44 bool initialized_;
44 double volume_; 45 double volume_;
45 46
46 // AudioRendererMixer is reference counted by all its AudioRendererMixerInputs 47 // Callbacks provided during construction which allow AudioRendererMixerInput
47 // and is destroyed when all AudioRendererMixerInputs have called RemoveMixer. 48 // to retrieve a mixer during Initialize() and notify when it's done with it.
48 scoped_refptr<AudioRendererMixer> mixer_; 49 GetMixerCB get_mixer_cb_;
50 RemoveMixerCB remove_mixer_cb_;
51
52 // AudioParameters received during Initialize().
53 AudioParameters params_;
54
55 // AudioRendererMixer provided through |get_mixer_cb_| during Initialize().
56 AudioRendererMixer* mixer_;
scherkus (not reviewing) 2012/07/14 01:45:02 add docs on ownership / lifetime (i.e., expected t
DaleCurtis 2012/07/14 02:10:03 Done.
49 57
50 // Source of audio data which is provided to the mixer. 58 // Source of audio data which is provided to the mixer.
51 AudioRendererSink::RenderCallback* callback_; 59 AudioRendererSink::RenderCallback* callback_;
52 60
53 // Vector for rendering audio data which will be used by the mixer.
54 std::vector<float*> audio_data_;
55
56 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput); 61 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput);
57 }; 62 };
58 63
59 } // namespace media 64 } // namespace media
60 65
61 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_ 66 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698