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 // RenderAudioSourceProvider provides a bridge between classes: | 5 // RenderAudioSourceProvider provides a bridge between classes: |
6 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink | 6 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink |
7 // | 7 // |
8 // RenderAudioSourceProvider is a "sink" of audio, and uses a default | 8 // RenderAudioSourceProvider is a "sink" of audio, and uses a default |
9 // AudioDevice if a client has not explicitly been set. | 9 // AudioDevice if a client has not explicitly been set. |
10 // | 10 // |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // If setClient() has been called, then WebKit calls provideInput() | 50 // If setClient() has been called, then WebKit calls provideInput() |
51 // periodically to get the rendered audio stream. | 51 // periodically to get the rendered audio stream. |
52 virtual void provideInput(const WebKit::WebVector<float*>& audio_data, | 52 virtual void provideInput(const WebKit::WebVector<float*>& audio_data, |
53 size_t number_of_frames); | 53 size_t number_of_frames); |
54 | 54 |
55 // AudioRendererSink implementation. | 55 // AudioRendererSink implementation. |
56 virtual void Start() OVERRIDE; | 56 virtual void Start() OVERRIDE; |
57 virtual void Stop() OVERRIDE; | 57 virtual void Stop() OVERRIDE; |
58 virtual void Play() OVERRIDE; | 58 virtual void Play() OVERRIDE; |
59 virtual void Pause(bool flush) OVERRIDE; | 59 virtual void Pause(bool flush) OVERRIDE; |
| 60 virtual void SetPlaybackRate(float rate) OVERRIDE; |
60 virtual bool SetVolume(double volume) OVERRIDE; | 61 virtual bool SetVolume(double volume) OVERRIDE; |
61 virtual void GetVolume(double* volume) OVERRIDE; | 62 virtual void GetVolume(double* volume) OVERRIDE; |
62 virtual void Initialize( | 63 virtual void Initialize( |
63 const media::AudioParameters& params, RenderCallback* renderer) OVERRIDE; | 64 const media::AudioParameters& params, RenderCallback* renderer) OVERRIDE; |
64 | 65 |
65 private: | 66 private: |
66 // Set to true when Initialize() is called. | 67 // Set to true when Initialize() is called. |
67 bool is_initialized_; | 68 bool is_initialized_; |
68 int channels_; | 69 int channels_; |
69 int sample_rate_; | 70 int sample_rate_; |
70 | 71 |
71 bool is_running_; | 72 bool is_running_; |
72 double volume_; | 73 double volume_; |
73 media::AudioRendererSink::RenderCallback* renderer_; | 74 media::AudioRendererSink::RenderCallback* renderer_; |
74 WebKit::WebAudioSourceProviderClient* client_; | 75 WebKit::WebAudioSourceProviderClient* client_; |
75 | 76 |
76 // Protects access to sink_ | 77 // Protects access to sink_ |
77 base::Lock sink_lock_; | 78 base::Lock sink_lock_; |
78 | 79 |
79 // default_sink_ is the default sink. | 80 // default_sink_ is the default sink. |
80 scoped_refptr<media::AudioRendererSink> default_sink_; | 81 scoped_refptr<media::AudioRendererSink> default_sink_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider); | 83 DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider); |
83 }; | 84 }; |
84 | 85 |
85 #endif // CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ | 86 #endif // CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ |
OLD | NEW |