Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 // sample-frames using the sink's RenderCallback to get the data. | 33 // sample-frames using the sink's RenderCallback to get the data. |
| 34 // | 34 // |
| 35 // All calls are protected by a lock. | 35 // All calls are protected by a lock. |
| 36 class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl | 36 class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl |
| 37 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), | 37 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), |
| 38 NON_EXPORTED_BASE(public RestartableAudioRendererSink) { | 38 NON_EXPORTED_BASE(public RestartableAudioRendererSink) { |
| 39 public: | 39 public: |
| 40 explicit WebAudioSourceProviderImpl( | 40 explicit WebAudioSourceProviderImpl( |
| 41 const scoped_refptr<RestartableAudioRendererSink>& sink); | 41 const scoped_refptr<RestartableAudioRendererSink>& sink); |
| 42 | 42 |
| 43 void enable_audio_focus() { enable_audio_focus_ = true; } | |
|
mlamouri (slow - plz ping)
2016/01/19 17:18:17
style: set_enable_audio_focus(bool), otherwise it
DaleCurtis
2016/02/03 02:15:31
There's no real preference over all of chrome (20
| |
| 44 | |
| 43 // blink::WebAudioSourceProvider implementation. | 45 // blink::WebAudioSourceProvider implementation. |
| 44 void setClient(blink::WebAudioSourceProviderClient* client) override; | 46 void setClient(blink::WebAudioSourceProviderClient* client) override; |
| 45 void provideInput(const blink::WebVector<float*>& audio_data, | 47 void provideInput(const blink::WebVector<float*>& audio_data, |
| 46 size_t number_of_frames) override; | 48 size_t number_of_frames) override; |
| 47 | 49 |
| 48 // RestartableAudioRendererSink implementation. | 50 // RestartableAudioRendererSink implementation. |
| 49 void Start() override; | 51 void Start() override; |
| 50 void Stop() override; | 52 void Stop() override; |
| 51 void Play() override; | 53 void Play() override; |
| 52 void Pause() override; | 54 void Pause() override; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 78 AudioRendererSink::RenderCallback* renderer_; | 80 AudioRendererSink::RenderCallback* renderer_; |
| 79 | 81 |
| 80 // When set via setClient() it overrides |sink_| for consuming audio. | 82 // When set via setClient() it overrides |sink_| for consuming audio. |
| 81 blink::WebAudioSourceProviderClient* client_; | 83 blink::WebAudioSourceProviderClient* client_; |
| 82 | 84 |
| 83 // Where audio ends up unless overridden by |client_|. | 85 // Where audio ends up unless overridden by |client_|. |
| 84 base::Lock sink_lock_; | 86 base::Lock sink_lock_; |
| 85 scoped_refptr<RestartableAudioRendererSink> sink_; | 87 scoped_refptr<RestartableAudioRendererSink> sink_; |
| 86 scoped_ptr<AudioBus> bus_wrapper_; | 88 scoped_ptr<AudioBus> bus_wrapper_; |
| 87 | 89 |
| 90 // If true, Initialize() will set AudioParamaters::FOCUSABLE. | |
| 91 bool enable_audio_focus_; | |
| 92 | |
| 88 // NOTE: Weak pointers must be invalidated before all other member variables. | 93 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 89 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; | 94 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; |
| 90 | 95 |
| 91 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); | 96 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); |
| 92 }; | 97 }; |
| 93 | 98 |
| 94 } // namespace media | 99 } // namespace media |
| 95 | 100 |
| 96 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 101 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
| OLD | NEW |