| 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 MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 5 #ifndef MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| 6 #define MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 6 #define MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "media/base/audio_renderer_sink.h" | 13 #include "media/base/audio_renderer_sink.h" |
| 14 #include "media/base/media_export.h" | 14 #include "media/blink/media_blink_export.h" |
| 15 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" | 15 #include "third_party/WebKit/public/platform/WebAudioSourceProvider.h" |
| 16 #include "third_party/WebKit/public/platform/WebVector.h" | 16 #include "third_party/WebKit/public/platform/WebVector.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 class WebAudioSourceProviderClient; | 19 class WebAudioSourceProviderClient; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace media { | 22 namespace media { |
| 23 | 23 |
| 24 // WebAudioSourceProviderImpl provides a bridge between classes: | 24 // WebAudioSourceProviderImpl provides a bridge between classes: |
| 25 // blink::WebAudioSourceProvider <---> AudioRendererSink | 25 // blink::WebAudioSourceProvider <---> AudioRendererSink |
| 26 // | 26 // |
| 27 // WebAudioSourceProviderImpl wraps an existing audio sink that is used unless | 27 // WebAudioSourceProviderImpl wraps an existing audio sink that is used unless |
| 28 // WebKit has set a client via setClient(). While a client is set WebKit will | 28 // WebKit has set a client via setClient(). While a client is set WebKit will |
| 29 // periodically call provideInput() to render a certain number of audio | 29 // periodically call provideInput() to render a certain number of audio |
| 30 // sample-frames using the sink's RenderCallback to get the data. | 30 // sample-frames using the sink's RenderCallback to get the data. |
| 31 // | 31 // |
| 32 // All calls are protected by a lock. | 32 // All calls are protected by a lock. |
| 33 class MEDIA_EXPORT WebAudioSourceProviderImpl | 33 class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl |
| 34 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), | 34 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), |
| 35 NON_EXPORTED_BASE(public AudioRendererSink) { | 35 NON_EXPORTED_BASE(public AudioRendererSink) { |
| 36 public: | 36 public: |
| 37 explicit WebAudioSourceProviderImpl( | 37 explicit WebAudioSourceProviderImpl( |
| 38 const scoped_refptr<AudioRendererSink>& sink); | 38 const scoped_refptr<AudioRendererSink>& sink); |
| 39 | 39 |
| 40 // blink::WebAudioSourceProvider implementation. | 40 // blink::WebAudioSourceProvider implementation. |
| 41 void setClient(blink::WebAudioSourceProviderClient* client) override; | 41 void setClient(blink::WebAudioSourceProviderClient* client) override; |
| 42 void provideInput(const blink::WebVector<float*>& audio_data, | 42 void provideInput(const blink::WebVector<float*>& audio_data, |
| 43 size_t number_of_frames) override; | 43 size_t number_of_frames) override; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // NOTE: Weak pointers must be invalidated before all other member variables. | 85 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 86 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; | 86 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; |
| 87 | 87 |
| 88 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); | 88 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 } // namespace media | 91 } // namespace media |
| 92 | 92 |
| 93 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 93 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| OLD | NEW |