| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Methods called on IO thread ---------------------------------------------- | 92 // Methods called on IO thread ---------------------------------------------- |
| 93 // AudioOutputIPCDelegate methods. | 93 // AudioOutputIPCDelegate methods. |
| 94 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; | 94 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; |
| 95 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 95 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
| 96 base::SyncSocket::Handle socket_handle, | 96 base::SyncSocket::Handle socket_handle, |
| 97 int length) OVERRIDE; | 97 int length) OVERRIDE; |
| 98 virtual void OnIPCClosed() OVERRIDE; | 98 virtual void OnIPCClosed() OVERRIDE; |
| 99 | 99 |
| 100 // Creates an uninitialized AudioOutputDevice. Clients must call Initialize() | 100 // Creates an uninitialized AudioOutputDevice. Clients must call Initialize() |
| 101 // before using. | 101 // before using. |
| 102 // TODO(tommi): When all dependencies on |content| have been removed | 102 AudioOutputDevice(scoped_ptr<AudioOutputIPC> ipc, |
| 103 // from AudioOutputDevice, move this class over to media/audio. | |
| 104 AudioOutputDevice(AudioOutputIPC* ipc, | |
| 105 const scoped_refptr<base::MessageLoopProxy>& io_loop); | 103 const scoped_refptr<base::MessageLoopProxy>& io_loop); |
| 106 | 104 |
| 107 protected: | 105 protected: |
| 108 // Magic required by ref_counted.h to avoid any code deleting the object | 106 // Magic required by ref_counted.h to avoid any code deleting the object |
| 109 // accidentally while there are references to it. | 107 // accidentally while there are references to it. |
| 110 friend class base::RefCountedThreadSafe<AudioOutputDevice>; | 108 friend class base::RefCountedThreadSafe<AudioOutputDevice>; |
| 111 virtual ~AudioOutputDevice(); | 109 virtual ~AudioOutputDevice(); |
| 112 | 110 |
| 113 private: | 111 private: |
| 114 // Methods called on IO thread ---------------------------------------------- | 112 // Methods called on IO thread ---------------------------------------------- |
| (...skipping 14 matching lines...) Expand all Loading... |
| 129 AudioParameters audio_parameters_; | 127 AudioParameters audio_parameters_; |
| 130 | 128 |
| 131 // The number of optional synchronized input channels having the same | 129 // The number of optional synchronized input channels having the same |
| 132 // sample-rate and buffer-size as specified in audio_parameters_. | 130 // sample-rate and buffer-size as specified in audio_parameters_. |
| 133 int input_channels_; | 131 int input_channels_; |
| 134 | 132 |
| 135 RenderCallback* callback_; | 133 RenderCallback* callback_; |
| 136 | 134 |
| 137 // A pointer to the IPC layer that takes care of sending requests over to | 135 // A pointer to the IPC layer that takes care of sending requests over to |
| 138 // the AudioRendererHost. | 136 // the AudioRendererHost. |
| 139 AudioOutputIPC* ipc_; | 137 scoped_ptr<AudioOutputIPC> ipc_; |
| 140 | 138 |
| 141 // Our stream ID on the message filter. Only accessed on the IO thread. | 139 // Our stream ID on the message filter. Only accessed on the IO thread. |
| 142 // Must only be modified on the IO thread. | 140 // Must only be modified on the IO thread. |
| 143 int stream_id_; | 141 int stream_id_; |
| 144 | 142 |
| 145 // State of Play() / Pause() calls before OnStreamCreated() is called. | 143 // State of Play() / Pause() calls before OnStreamCreated() is called. |
| 146 bool play_on_start_; | 144 bool play_on_start_; |
| 147 | 145 |
| 148 // Set to |true| when OnStreamCreated() is called. | 146 // Set to |true| when OnStreamCreated() is called. |
| 149 // Set to |false| when ShutDownOnIOThread() is called. | 147 // Set to |false| when ShutDownOnIOThread() is called. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 167 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept | 165 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept |
| 168 // the callback via Start(). See http://crbug.com/151051 for details. | 166 // the callback via Start(). See http://crbug.com/151051 for details. |
| 169 bool stopping_hack_; | 167 bool stopping_hack_; |
| 170 | 168 |
| 171 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); | 169 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 } // namespace media | 172 } // namespace media |
| 175 | 173 |
| 176 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 174 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
| OLD | NEW |