| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 WEBKIT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| 6 #define WEBKIT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "content/common/content_export.h" |
| 9 #include "media/base/audio_renderer_sink.h" | 10 #include "media/base/audio_renderer_sink.h" |
| 10 #include "third_party/WebKit/public/platform/WebVector.h" | 11 #include "third_party/WebKit/public/platform/WebVector.h" |
| 11 #include "third_party/WebKit/public/web/WebAudioSourceProvider.h" | 12 #include "third_party/WebKit/public/web/WebAudioSourceProvider.h" |
| 12 | 13 |
| 13 namespace WebKit { | 14 namespace WebKit { |
| 14 class WebAudioSourceProviderClient; | 15 class WebAudioSourceProviderClient; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace webkit_media { | 18 namespace content { |
| 18 | 19 |
| 19 // WebAudioSourceProviderImpl provides a bridge between classes: | 20 // WebAudioSourceProviderImpl provides a bridge between classes: |
| 20 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink | 21 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink |
| 21 // | 22 // |
| 22 // WebAudioSourceProviderImpl wraps an existing audio sink that is used unless | 23 // WebAudioSourceProviderImpl wraps an existing audio sink that is used unless |
| 23 // WebKit has set a client via setClient(). While a client is set WebKit will | 24 // WebKit has set a client via setClient(). While a client is set WebKit will |
| 24 // periodically call provideInput() to render a certain number of audio | 25 // periodically call provideInput() to render a certain number of audio |
| 25 // sample-frames using the sink's RenderCallback to get the data. | 26 // sample-frames using the sink's RenderCallback to get the data. |
| 26 // | 27 // |
| 27 // All calls are protected by a lock. | 28 // All calls are protected by a lock. |
| 28 class WebAudioSourceProviderImpl | 29 class CONTENT_EXPORT WebAudioSourceProviderImpl |
| 29 : public WebKit::WebAudioSourceProvider, | 30 : public WebKit::WebAudioSourceProvider, |
| 30 public media::AudioRendererSink { | 31 public media::AudioRendererSink { |
| 31 public: | 32 public: |
| 32 explicit WebAudioSourceProviderImpl( | 33 explicit WebAudioSourceProviderImpl( |
| 33 const scoped_refptr<media::AudioRendererSink>& sink); | 34 const scoped_refptr<media::AudioRendererSink>& sink); |
| 34 | 35 |
| 35 // WebKit::WebAudioSourceProvider implementation. | 36 // WebKit::WebAudioSourceProvider implementation. |
| 36 virtual void setClient(WebKit::WebAudioSourceProviderClient* client); | 37 virtual void setClient(WebKit::WebAudioSourceProviderClient* client); |
| 37 virtual void provideInput(const WebKit::WebVector<float*>& audio_data, | 38 virtual void provideInput(const WebKit::WebVector<float*>& audio_data, |
| 38 size_t number_of_frames); | 39 size_t number_of_frames); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 66 WebKit::WebAudioSourceProviderClient* client_; | 67 WebKit::WebAudioSourceProviderClient* client_; |
| 67 | 68 |
| 68 // Where audio ends up unless overridden by |client_|. | 69 // Where audio ends up unless overridden by |client_|. |
| 69 base::Lock sink_lock_; | 70 base::Lock sink_lock_; |
| 70 scoped_refptr<media::AudioRendererSink> sink_; | 71 scoped_refptr<media::AudioRendererSink> sink_; |
| 71 scoped_ptr<media::AudioBus> bus_wrapper_; | 72 scoped_ptr<media::AudioBus> bus_wrapper_; |
| 72 | 73 |
| 73 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); | 74 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace webkit_media | 77 } // namespace content |
| 77 | 78 |
| 78 #endif // WEBKIT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 79 #endif // CONTENT_RENDERER_MEDIA_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| OLD | NEW |