Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: media/blink/webaudiosourceprovider_impl.h

Issue 2003963003: Reland: MediaCaptureFromElement: add support for audio captureStream(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WASPImpl can be initialized after HTMLAudioElementCapturerSource Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 int RenderForTesting(AudioBus* audio_bus);
76
75 private: 77 private:
76 friend class WebAudioSourceProviderImplTest; 78 friend class WebAudioSourceProviderImplTest;
77 ~WebAudioSourceProviderImpl() override; 79 ~WebAudioSourceProviderImpl() override;
78 80
79 // Calls setFormat() on |client_| from the Blink renderer thread. 81 // Calls setFormat() on |client_| from the Blink renderer thread.
80 void OnSetFormat(); 82 void OnSetFormat();
81 83
82 int RenderForTesting(AudioBus* audio_bus);
83
84 // Used to keep the volume across reconfigurations. 84 // Used to keep the volume across reconfigurations.
85 double volume_; 85 double volume_;
86 86
87 // Tracks the current playback state. 87 // Tracks the current playback state.
88 enum PlaybackState { kStopped, kStarted, kPlaying }; 88 enum PlaybackState { kStopped, kStarted, kPlaying };
89 PlaybackState state_; 89 PlaybackState state_;
90 90
91 // Closure that calls OnSetFormat() on |client_| on the renderer thread. 91 // Closure that calls OnSetFormat() on |client_| on the renderer thread.
92 base::Closure set_format_cb_; 92 base::Closure set_format_cb_;
93 // When set via setClient() it overrides |sink_| for consuming audio. 93 // When set via setClient() it overrides |sink_| for consuming audio.
94 blink::WebAudioSourceProviderClient* client_; 94 blink::WebAudioSourceProviderClient* client_;
95 95
96 // Where audio ends up unless overridden by |client_|. 96 // Where audio ends up unless overridden by |client_|.
97 base::Lock sink_lock_; 97 base::Lock sink_lock_;
98 const scoped_refptr<SwitchableAudioRendererSink> sink_; 98 const scoped_refptr<SwitchableAudioRendererSink> sink_;
99 std::unique_ptr<AudioBus> bus_wrapper_; 99 std::unique_ptr<AudioBus> bus_wrapper_;
100 100
101 // An inner class acting as a T filter where actual data can be tapped. 101 // An inner class acting as a T filter where actual data can be tapped.
102 class TeeFilter; 102 class TeeFilter;
103 std::unique_ptr<TeeFilter> tee_filter_; 103 const std::unique_ptr<TeeFilter> tee_filter_;
104 104
105 // NOTE: Weak pointers must be invalidated before all other member variables. 105 // NOTE: Weak pointers must be invalidated before all other member variables.
106 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_; 106 base::WeakPtrFactory<WebAudioSourceProviderImpl> weak_factory_;
107 107
108 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl); 108 DISALLOW_IMPLICIT_CONSTRUCTORS(WebAudioSourceProviderImpl);
109 }; 109 };
110 110
111 } // namespace media 111 } // namespace media
112 112
113 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_ 113 #endif // MEDIA_BLINK_WEBAUDIOSOURCEPROVIDER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698