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

Side by Side Diff: media/audio/audio_output_device.h

Issue 1809093003: Moving SwitchOutputDevice out of OutputDevice interface, eliminating OutputDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace RestartableAudioRendererSink with SwitchableAudioRendererSink in webmediaplayer_impl unit t… Created 4 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Audio rendering unit utilizing audio output stream provided by browser 5 // Audio rendering unit utilizing audio output stream provided by browser
6 // process through IPC. 6 // process through IPC.
7 // 7 //
8 // Relationship of classes. 8 // Relationship of classes.
9 // 9 //
10 // AudioOutputController AudioOutputDevice 10 // AudioOutputController AudioOutputDevice
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 void Start() override; 102 void Start() override;
103 void Stop() override; 103 void Stop() override;
104 void Play() override; 104 void Play() override;
105 void Pause() override; 105 void Pause() override;
106 bool SetVolume(double volume) override; 106 bool SetVolume(double volume) override;
107 OutputDevice* GetOutputDevice() override; 107 OutputDevice* GetOutputDevice() override;
108 108
109 // OutputDevice implementation 109 // OutputDevice implementation
110 AudioParameters GetOutputParameters() override; 110 AudioParameters GetOutputParameters() override;
111 OutputDeviceStatus GetDeviceStatus() override; 111 OutputDeviceStatus GetDeviceStatus() override;
112 std::string GetDeviceId() override;
112 113
113 // Methods called on IO thread ---------------------------------------------- 114 // Methods called on IO thread ----------------------------------------------
114 // AudioOutputIPCDelegate methods. 115 // AudioOutputIPCDelegate methods.
115 void OnStateChanged(AudioOutputIPCDelegateState state) override; 116 void OnStateChanged(AudioOutputIPCDelegateState state) override;
116 void OnDeviceAuthorized(OutputDeviceStatus device_status, 117 void OnDeviceAuthorized(OutputDeviceStatus device_status,
117 const media::AudioParameters& output_params) override; 118 const media::AudioParameters& output_params) override;
118 void OnStreamCreated(base::SharedMemoryHandle handle, 119 void OnStreamCreated(base::SharedMemoryHandle handle,
119 base::SyncSocket::Handle socket_handle, 120 base::SyncSocket::Handle socket_handle,
120 int length) override; 121 int length) override;
121 void OnIPCClosed() override; 122 void OnIPCClosed() override;
122 123
123 protected: 124 protected:
124 // Magic required by ref_counted.h to avoid any code deleting the object 125 // Magic required by ref_counted.h to avoid any code deleting the object
125 // accidentally while there are references to it. 126 // accidentally while there are references to it.
126 friend class base::RefCountedThreadSafe<AudioOutputDevice>; 127 friend class base::RefCountedThreadSafe<AudioOutputDevice>;
127 ~AudioOutputDevice() override; 128 ~AudioOutputDevice() override;
128 129
129 private: 130 private:
130 // Note: The ordering of members in this enum is critical to correct behavior! 131 // Note: The ordering of members in this enum is critical to correct behavior!
131 enum State { 132 enum State {
132 IPC_CLOSED, // No more IPCs can take place. 133 IPC_CLOSED, // No more IPCs can take place.
133 IDLE, // Not started. 134 IDLE, // Not started.
134 AUTHORIZING, // Sent device authorization request, waiting for reply. 135 AUTHORIZING, // Sent device authorization request, waiting for reply.
135 AUTHORIZED, // Successful device authorization received. 136 AUTHORIZED, // Successful device authorization received.
136 CREATING_STREAM, // Waiting for OnStreamCreated() to be called back. 137 CREATING_STREAM, // Waiting for OnStreamCreated() to be called back.
137 PAUSED, // Paused. OnStreamCreated() has been called. Can Play()/Stop(). 138 PAUSED, // Paused. OnStreamCreated() has been called. Can Play()/Stop().
138 PLAYING, // Playing back. Can Pause()/Stop(). 139 PLAYING, // Playing back. Can Pause()/Stop().
139 }; 140 };
140 141
141 // Unsupported OutputDevice implementation
142 void SwitchOutputDevice(const std::string& device_id,
143 const url::Origin& security_origin,
144 const SwitchOutputDeviceCB& callback) override;
145
146 // Methods called on IO thread ---------------------------------------------- 142 // Methods called on IO thread ----------------------------------------------
147 // The following methods are tasks posted on the IO thread that need to 143 // The following methods are tasks posted on the IO thread that need to
148 // be executed on that thread. They use AudioOutputIPC to send IPC messages 144 // be executed on that thread. They use AudioOutputIPC to send IPC messages
149 // upon state changes. 145 // upon state changes.
150 void RequestDeviceAuthorizationOnIOThread(); 146 void RequestDeviceAuthorizationOnIOThread();
151 void CreateStreamOnIOThread(const AudioParameters& params); 147 void CreateStreamOnIOThread(const AudioParameters& params);
152 void PlayOnIOThread(); 148 void PlayOnIOThread();
153 void PauseOnIOThread(); 149 void PauseOnIOThread();
154 void ShutDownOnIOThread(); 150 void ShutDownOnIOThread();
155 void SetVolumeOnIOThread(double volume); 151 void SetVolumeOnIOThread(double volume);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 base::WaitableEvent did_receive_auth_; 201 base::WaitableEvent did_receive_auth_;
206 media::AudioParameters output_params_; 202 media::AudioParameters output_params_;
207 OutputDeviceStatus device_status_; 203 OutputDeviceStatus device_status_;
208 204
209 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); 205 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice);
210 }; 206 };
211 207
212 } // namespace media 208 } // namespace media
213 209
214 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ 210 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698