| 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 // Low-latency audio capturing class utilizing audio input stream provided | 5 // Low-latency audio capturing class utilizing audio input stream provided |
| 6 // by a server (browser) process by use of an IPC interface. | 6 // by a server (browser) process by use of an IPC interface. |
| 7 // | 7 // |
| 8 // Relationship of classes: | 8 // Relationship of classes: |
| 9 // | 9 // |
| 10 // AudioInputController AudioInputDevice | 10 // AudioInputController AudioInputDevice |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 CaptureEventHandler* event_handler) OVERRIDE; | 96 CaptureEventHandler* event_handler) OVERRIDE; |
| 97 virtual void Start() OVERRIDE; | 97 virtual void Start() OVERRIDE; |
| 98 virtual void Stop() OVERRIDE; | 98 virtual void Stop() OVERRIDE; |
| 99 virtual void SetVolume(double volume) OVERRIDE; | 99 virtual void SetVolume(double volume) OVERRIDE; |
| 100 virtual void SetDevice(int session_id) OVERRIDE; | 100 virtual void SetDevice(int session_id) OVERRIDE; |
| 101 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; | 101 virtual void SetAutomaticGainControl(bool enabled) OVERRIDE; |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 // Methods called on IO thread ---------------------------------------------- | 104 // Methods called on IO thread ---------------------------------------------- |
| 105 // AudioInputIPCDelegate implementation. | 105 // AudioInputIPCDelegate implementation. |
| 106 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 106 virtual void OnStreamCreated(base::SyncSocket::Handle socket_handle, |
| 107 base::SyncSocket::Handle socket_handle, | 107 int total_handles) OVERRIDE; |
| 108 int length) OVERRIDE; | 108 virtual void OnSharedMemoryCreated(base::SharedMemoryHandle handle, |
| 109 int length, |
| 110 int index) OVERRIDE; |
| 109 virtual void OnVolume(double volume) OVERRIDE; | 111 virtual void OnVolume(double volume) OVERRIDE; |
| 110 virtual void OnStateChanged( | 112 virtual void OnStateChanged( |
| 111 AudioInputIPCDelegate::State state) OVERRIDE; | 113 AudioInputIPCDelegate::State state) OVERRIDE; |
| 112 virtual void OnDeviceReady(const std::string& device_id) OVERRIDE; | 114 virtual void OnDeviceReady(const std::string& device_id) OVERRIDE; |
| 113 virtual void OnIPCClosed() OVERRIDE; | 115 virtual void OnIPCClosed() OVERRIDE; |
| 114 | 116 |
| 115 friend class base::RefCountedThreadSafe<AudioInputDevice>; | 117 friend class base::RefCountedThreadSafe<AudioInputDevice>; |
| 116 virtual ~AudioInputDevice(); | 118 virtual ~AudioInputDevice(); |
| 117 | 119 |
| 118 private: | 120 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 130 // MessageLoop::DestructionObserver implementation for the IO loop. | 132 // MessageLoop::DestructionObserver implementation for the IO loop. |
| 131 // If the IO loop dies before we do, we shut down the audio thread from here. | 133 // If the IO loop dies before we do, we shut down the audio thread from here. |
| 132 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 134 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
| 133 | 135 |
| 134 AudioParameters audio_parameters_; | 136 AudioParameters audio_parameters_; |
| 135 | 137 |
| 136 CaptureCallback* callback_; | 138 CaptureCallback* callback_; |
| 137 CaptureEventHandler* event_handler_; | 139 CaptureEventHandler* event_handler_; |
| 138 | 140 |
| 139 AudioInputIPC* ipc_; | 141 AudioInputIPC* ipc_; |
| 142 base::SyncSocket::Handle socket_handle_; |
| 143 AudioDeviceThread::Callback::SharedMemoryHandleVector shared_memory_handles_; |
| 144 int received_shared_memory_count_; |
| 140 | 145 |
| 141 // Our stream ID on the message filter. Only modified on the IO thread. | 146 // Our stream ID on the message filter. Only modified on the IO thread. |
| 142 int stream_id_; | 147 int stream_id_; |
| 143 | 148 |
| 144 // The media session ID used to identify which input device to be started. | 149 // The media session ID used to identify which input device to be started. |
| 145 // Only modified on the IO thread. | 150 // Only modified on the IO thread. |
| 146 int session_id_; | 151 int session_id_; |
| 147 | 152 |
| 148 // State variable used to indicate it is waiting for a OnDeviceReady() | 153 // State variable used to indicate it is waiting for a OnDeviceReady() |
| 149 // callback. Only modified on the IO thread. | 154 // callback. Only modified on the IO thread. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 base::Lock audio_thread_lock_; | 166 base::Lock audio_thread_lock_; |
| 162 AudioDeviceThread audio_thread_; | 167 AudioDeviceThread audio_thread_; |
| 163 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; | 168 scoped_ptr<AudioInputDevice::AudioThreadCallback> audio_callback_; |
| 164 | 169 |
| 165 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); | 170 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); |
| 166 }; | 171 }; |
| 167 | 172 |
| 168 } // namespace media | 173 } // namespace media |
| 169 | 174 |
| 170 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ | 175 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ |
| OLD | NEW |