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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 void Pause() override; | 62 void Pause() override; |
| 63 bool SetVolume(double volume) override; | 63 bool SetVolume(double volume) override; |
| 64 OutputDeviceInfo GetOutputDeviceInfo() override; | 64 OutputDeviceInfo GetOutputDeviceInfo() override; |
| 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 virtual void SetCopyAudioCallback(const CopyAudioCB& callback); |
|
miu
2016/05/13 23:40:35
Why are these methods being made virtual?
mcasas
2016/05/14 02:23:47
For MockWebAudioSourceProvider in
html_audio_elem
| |
| 73 void ClearCopyAudioCallback(); | 73 virtual void ClearCopyAudioCallback(); |
| 74 base::WeakPtr<WebAudioSourceProviderImpl> AsWeakPtr() { | |
| 75 return weak_factory_.GetWeakPtr(); | |
| 76 } | |
| 74 | 77 |
| 75 private: | 78 protected: |
| 76 friend class WebAudioSourceProviderImplTest; | 79 friend class WebAudioSourceProviderImplTest; |
| 77 ~WebAudioSourceProviderImpl() override; | 80 ~WebAudioSourceProviderImpl() override; |
| 78 | 81 |
| 82 private: | |
| 79 // Calls setFormat() on |client_| from the Blink renderer thread. | 83 // Calls setFormat() on |client_| from the Blink renderer thread. |
| 80 void OnSetFormat(); | 84 void OnSetFormat(); |
| 81 | 85 |
| 82 int RenderForTesting(AudioBus* audio_bus); | 86 int RenderForTesting(AudioBus* audio_bus); |
| 83 | 87 |
| 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 }; |
| (...skipping 15 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 |