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