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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // All calls are protected by a lock. | 42 // All calls are protected by a lock. |
43 class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl | 43 class MEDIA_BLINK_EXPORT WebAudioSourceProviderImpl |
44 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), | 44 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), |
45 NON_EXPORTED_BASE(public SwitchableAudioRendererSink) { | 45 NON_EXPORTED_BASE(public SwitchableAudioRendererSink) { |
46 public: | 46 public: |
47 using CopyAudioCB = base::Callback<void(std::unique_ptr<AudioBus>, | 47 using CopyAudioCB = base::Callback<void(std::unique_ptr<AudioBus>, |
48 uint32_t frames_delayed, | 48 uint32_t frames_delayed, |
49 int sample_rate)>; | 49 int sample_rate)>; |
50 | 50 |
51 WebAudioSourceProviderImpl(scoped_refptr<SwitchableAudioRendererSink> sink, | 51 WebAudioSourceProviderImpl(scoped_refptr<SwitchableAudioRendererSink> sink, |
52 scoped_refptr<MediaLog> media_log); | 52 MediaLog* media_log); |
53 | 53 |
54 // blink::WebAudioSourceProvider implementation. | 54 // blink::WebAudioSourceProvider implementation. |
55 void SetClient(blink::WebAudioSourceProviderClient* client) override; | 55 void SetClient(blink::WebAudioSourceProviderClient* client) override; |
56 void ProvideInput(const blink::WebVector<float*>& audio_data, | 56 void ProvideInput(const blink::WebVector<float*>& audio_data, |
57 size_t number_of_frames) override; | 57 size_t number_of_frames) override; |
58 | 58 |
59 // RestartableAudioRendererSink implementation. | 59 // RestartableAudioRendererSink implementation. |
60 void Initialize(const AudioParameters& params, | 60 void Initialize(const AudioParameters& params, |
61 RenderCallback* renderer) override; | 61 RenderCallback* renderer) override; |
62 void Start() override; | 62 void Start() override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Where audio ends up unless overridden by |client_|. | 101 // Where audio ends up unless overridden by |client_|. |
102 base::Lock sink_lock_; | 102 base::Lock sink_lock_; |
103 scoped_refptr<SwitchableAudioRendererSink> sink_; | 103 scoped_refptr<SwitchableAudioRendererSink> sink_; |
104 std::unique_ptr<AudioBus> bus_wrapper_; | 104 std::unique_ptr<AudioBus> bus_wrapper_; |
105 | 105 |
106 // An inner class acting as a T filter where actual data can be tapped. | 106 // An inner class acting as a T filter where actual data can be tapped. |
107 class TeeFilter; | 107 class TeeFilter; |
108 const std::unique_ptr<TeeFilter> tee_filter_; | 108 const std::unique_ptr<TeeFilter> tee_filter_; |
109 | 109 |
110 const scoped_refptr<MediaLog> media_log_; | 110 MediaLog* const media_log_; |
111 | 111 |
112 // NOTE: Weak pointers must be invalidated before all other member variables. | 112 // NOTE: Weak pointers must be invalidated before all other member variables. |
113 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; | 113 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; |
114 | 114 |
115 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); | 115 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); |
116 }; | 116 }; |
117 | 117 |
118 } // namespace media | 118 } // namespace media |
119 | 119 |
120 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 120 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
OLD | NEW |