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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 void Initialize(const AudioParameters& params, | 65 void Initialize(const AudioParameters& params, |
66 RenderCallback* renderer) override; | 66 RenderCallback* renderer) override; |
67 void SwitchOutputDevice(const std::string& device_id, | 67 void SwitchOutputDevice(const std::string& device_id, |
68 const url::Origin& security_origin, | 68 const url::Origin& security_origin, |
69 const OutputDeviceStatusCB& callback) override; | 69 const OutputDeviceStatusCB& callback) override; |
70 | 70 |
71 // These methods allow a client to get a copy of the rendered audio. | 71 // These methods allow a client to get a copy of the rendered audio. |
72 void SetCopyAudioCallback(const CopyAudioCB& callback); | 72 void SetCopyAudioCallback(const CopyAudioCB& callback); |
73 void ClearCopyAudioCallback(); | 73 void ClearCopyAudioCallback(); |
74 | 74 |
75 base::WeakPtr<WebAudioSourceProviderImpl> AsWeakPtr() { | |
76 return weak_factory_.GetWeakPtr(); | |
77 } | |
78 | |
79 int RenderForTesting(AudioBus* audio_bus); | |
miu
2016/05/19 22:44:30
Not sure you should have made this public. Instead
mcasas
2016/05/19 23:57:55
provideInput() is only available for the render-to
| |
80 | |
75 private: | 81 private: |
76 friend class WebAudioSourceProviderImplTest; | 82 friend class WebAudioSourceProviderImplTest; |
77 ~WebAudioSourceProviderImpl() override; | 83 ~WebAudioSourceProviderImpl() override; |
78 | 84 |
79 // Calls setFormat() on |client_| from the Blink renderer thread. | 85 // Calls setFormat() on |client_| from the Blink renderer thread. |
80 void OnSetFormat(); | 86 void OnSetFormat(); |
81 | 87 |
82 int RenderForTesting(AudioBus* audio_bus); | |
83 | |
84 // Used to keep the volume across reconfigurations. | 88 // Used to keep the volume across reconfigurations. |
85 double volume_; | 89 double volume_; |
86 | 90 |
87 // Tracks the current playback state. | 91 // Tracks the current playback state. |
88 enum PlaybackState { kStopped, kStarted, kPlaying }; | 92 enum PlaybackState { kStopped, kStarted, kPlaying }; |
89 PlaybackState state_; | 93 PlaybackState state_; |
90 | 94 |
91 // Closure that calls OnSetFormat() on |client_| on the renderer thread. | 95 // Closure that calls OnSetFormat() on |client_| on the renderer thread. |
92 base::Closure set_format_cb_; | 96 base::Closure set_format_cb_; |
93 // When set via setClient() it overrides |sink_| for consuming audio. | 97 // When set via setClient() it overrides |sink_| for consuming audio. |
(...skipping 10 matching lines...) Expand all Loading... | |
104 | 108 |
105 // NOTE: Weak pointers must be invalidated before all other member variables. | 109 // NOTE: Weak pointers must be invalidated before all other member variables. |
106 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; | 110 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; |
107 | 111 |
108 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); | 112 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); |
109 }; | 113 }; |
110 | 114 |
111 } // namespace media | 115 } // namespace media |
112 | 116 |
113 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ | 117 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ |
OLD | NEW |