Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 | 88 |
| 89 // Methods called on IO thread ---------------------------------------------- | 89 // Methods called on IO thread ---------------------------------------------- |
| 90 // AudioOutputIPCDelegate methods. | 90 // AudioOutputIPCDelegate methods. |
| 91 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; | 91 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; |
| 92 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 92 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
| 93 base::SyncSocket::Handle socket_handle, | 93 base::SyncSocket::Handle socket_handle, |
| 94 int length) OVERRIDE; | 94 int length) OVERRIDE; |
| 95 virtual void OnIPCClosed() OVERRIDE; | 95 virtual void OnIPCClosed() OVERRIDE; |
| 96 | 96 |
| 97 // Creates an uninitialized AudioOutputDevice. Clients must call Initialize() | 97 // Creates an uninitialized AudioOutputDevice. Clients must call Initialize() |
| 98 // before using. | 98 // before using. Takes owner ship of |ipc|. |
|
tommi (sloooow) - chröme
2012/07/31 10:52:41
great.
also, s/owner ship/ownership.
sail
2012/07/31 22:02:08
Done.
| |
| 99 // TODO(tommi): When all dependencies on |content| have been removed | |
| 100 // from AudioOutputDevice, move this class over to media/audio. | |
| 101 AudioOutputDevice(AudioOutputIPC* ipc, | 99 AudioOutputDevice(AudioOutputIPC* ipc, |
| 102 const scoped_refptr<base::MessageLoopProxy>& io_loop); | 100 const scoped_refptr<base::MessageLoopProxy>& io_loop); |
| 103 | 101 |
| 104 protected: | 102 protected: |
| 105 // Magic required by ref_counted.h to avoid any code deleting the object | 103 // Magic required by ref_counted.h to avoid any code deleting the object |
| 106 // accidentally while there are references to it. | 104 // accidentally while there are references to it. |
| 107 friend class base::RefCountedThreadSafe<AudioOutputDevice>; | 105 friend class base::RefCountedThreadSafe<AudioOutputDevice>; |
| 108 virtual ~AudioOutputDevice(); | 106 virtual ~AudioOutputDevice(); |
| 109 | 107 |
| 110 private: | 108 private: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 121 // MessageLoop::DestructionObserver implementation for the IO loop. | 119 // MessageLoop::DestructionObserver implementation for the IO loop. |
| 122 // If the IO loop dies before we do, we shut down the audio thread from here. | 120 // If the IO loop dies before we do, we shut down the audio thread from here. |
| 123 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 121 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
| 124 | 122 |
| 125 AudioParameters audio_parameters_; | 123 AudioParameters audio_parameters_; |
| 126 | 124 |
| 127 RenderCallback* callback_; | 125 RenderCallback* callback_; |
| 128 | 126 |
| 129 // A pointer to the IPC layer that takes care of sending requests over to | 127 // A pointer to the IPC layer that takes care of sending requests over to |
| 130 // the AudioRendererHost. | 128 // the AudioRendererHost. |
| 131 AudioOutputIPC* ipc_; | 129 scoped_ptr<AudioOutputIPC> ipc_; |
| 132 | 130 |
| 133 // Our stream ID on the message filter. Only accessed on the IO thread. | 131 // Our stream ID on the message filter. Only accessed on the IO thread. |
| 134 // Must only be modified on the IO thread. | 132 // Must only be modified on the IO thread. |
| 135 int stream_id_; | 133 int stream_id_; |
| 136 | 134 |
| 137 // State of Play() / Pause() calls before OnStreamCreated() is called. | 135 // State of Play() / Pause() calls before OnStreamCreated() is called. |
| 138 bool play_on_start_; | 136 bool play_on_start_; |
| 139 | 137 |
| 140 // Set to |true| when OnStreamCreated() is called. | 138 // Set to |true| when OnStreamCreated() is called. |
| 141 // Set to |false| when ShutDownOnIOThread() is called. | 139 // Set to |false| when ShutDownOnIOThread() is called. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 152 AudioDeviceThread audio_thread_; | 150 AudioDeviceThread audio_thread_; |
| 153 scoped_ptr<AudioOutputDevice::AudioThreadCallback> audio_callback_; | 151 scoped_ptr<AudioOutputDevice::AudioThreadCallback> audio_callback_; |
| 154 | 152 |
| 155 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); | 153 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); |
| 156 }; | 154 }; |
| 157 | 155 |
| 158 } // namespace media | 156 } // namespace media |
| 159 | 157 |
| 160 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 158 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
| 161 | 159 |
| OLD | NEW |