| OLD | NEW |
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void Play() override; | 103 void Play() override; |
| 104 void Pause() override; | 104 void Pause() override; |
| 105 bool SetVolume(double volume) override; | 105 bool SetVolume(double volume) override; |
| 106 OutputDeviceInfo GetOutputDeviceInfo() override; | 106 OutputDeviceInfo GetOutputDeviceInfo() override; |
| 107 | 107 |
| 108 // Methods called on IO thread ---------------------------------------------- | 108 // Methods called on IO thread ---------------------------------------------- |
| 109 // AudioOutputIPCDelegate methods. | 109 // AudioOutputIPCDelegate methods. |
| 110 void OnStateChanged(AudioOutputIPCDelegateState state) override; | 110 void OnStateChanged(AudioOutputIPCDelegateState state) override; |
| 111 void OnDeviceAuthorized(OutputDeviceStatus device_status, | 111 void OnDeviceAuthorized(OutputDeviceStatus device_status, |
| 112 const media::AudioParameters& output_params) override; | 112 const media::AudioParameters& output_params) override; |
| 113 void OnStreamCreated(base::SharedMemoryHandle handle, | 113 void OnStreamCreated(content::mojom::AudioOutputStreamPtr* stream, |
| 114 base::SharedMemoryHandle handle, |
| 114 base::SyncSocket::Handle socket_handle, | 115 base::SyncSocket::Handle socket_handle, |
| 115 int length) override; | 116 int length) override; |
| 116 void OnIPCClosed() override; | 117 void OnIPCClosed() override; |
| 117 | 118 |
| 119 AudioOutputIPC* getIPC() override; |
| 120 |
| 118 protected: | 121 protected: |
| 119 // Magic required by ref_counted.h to avoid any code deleting the object | 122 // Magic required by ref_counted.h to avoid any code deleting the object |
| 120 // accidentally while there are references to it. | 123 // accidentally while there are references to it. |
| 121 friend class base::RefCountedThreadSafe<AudioOutputDevice>; | 124 friend class base::RefCountedThreadSafe<AudioOutputDevice>; |
| 122 ~AudioOutputDevice() override; | 125 ~AudioOutputDevice() override; |
| 123 | 126 |
| 124 private: | 127 private: |
| 125 // Note: The ordering of members in this enum is critical to correct behavior! | 128 // Note: The ordering of members in this enum is critical to correct behavior! |
| 126 enum State { | 129 enum State { |
| 127 IPC_CLOSED, // No more IPCs can take place. | 130 IPC_CLOSED, // No more IPCs can take place. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 150 | 153 |
| 151 AudioParameters audio_parameters_; | 154 AudioParameters audio_parameters_; |
| 152 | 155 |
| 153 RenderCallback* callback_; | 156 RenderCallback* callback_; |
| 154 | 157 |
| 155 // A pointer to the IPC layer that takes care of sending requests over to | 158 // A pointer to the IPC layer that takes care of sending requests over to |
| 156 // the AudioRendererHost. Only valid when state_ != IPC_CLOSED and must only | 159 // the AudioRendererHost. Only valid when state_ != IPC_CLOSED and must only |
| 157 // be accessed on the IO thread. | 160 // be accessed on the IO thread. |
| 158 scoped_ptr<AudioOutputIPC> ipc_; | 161 scoped_ptr<AudioOutputIPC> ipc_; |
| 159 | 162 |
| 163 content::mojom::AudioOutputStreamPtr* stream_; |
| 164 |
| 160 // Current state (must only be accessed from the IO thread). See comments for | 165 // Current state (must only be accessed from the IO thread). See comments for |
| 161 // State enum above. | 166 // State enum above. |
| 162 State state_; | 167 State state_; |
| 163 | 168 |
| 164 // State of Start() calls before OnDeviceAuthorized() is called. | 169 // State of Start() calls before OnDeviceAuthorized() is called. |
| 165 bool start_on_authorized_; | 170 bool start_on_authorized_; |
| 166 | 171 |
| 167 // State of Play() / Pause() calls before OnStreamCreated() is called. | 172 // State of Play() / Pause() calls before OnStreamCreated() is called. |
| 168 bool play_on_start_; | 173 bool play_on_start_; |
| 169 | 174 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 195 base::WaitableEvent did_receive_auth_; | 200 base::WaitableEvent did_receive_auth_; |
| 196 AudioParameters output_params_; | 201 AudioParameters output_params_; |
| 197 OutputDeviceStatus device_status_; | 202 OutputDeviceStatus device_status_; |
| 198 | 203 |
| 199 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); | 204 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); |
| 200 }; | 205 }; |
| 201 | 206 |
| 202 } // namespace media | 207 } // namespace media |
| 203 | 208 |
| 204 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 209 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
| OLD | NEW |