| 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 #include "media/audio/audio_input_device.h" | 5 #include "media/audio/audio_input_device.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return; | 131 return; |
| 132 | 132 |
| 133 base::AutoLock auto_lock(audio_thread_lock_); | 133 base::AutoLock auto_lock(audio_thread_lock_); |
| 134 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice. | 134 // TODO(miu): See TODO in OnStreamCreated method for AudioOutputDevice. |
| 135 // Interface changes need to be made; likely, after AudioInputDevice is merged | 135 // Interface changes need to be made; likely, after AudioInputDevice is merged |
| 136 // into AudioOutputDevice (http://crbug.com/179597). | 136 // into AudioOutputDevice (http://crbug.com/179597). |
| 137 if (stopping_hack_) | 137 if (stopping_hack_) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 DCHECK(audio_thread_.IsStopped()); | 140 DCHECK(audio_thread_.IsStopped()); |
| 141 audio_callback_.reset( | 141 audio_callback_.reset(new AudioInputDevice::AudioThreadCallback( |
| 142 new AudioInputDevice::AudioThreadCallback( | 142 audio_parameters_, handle, length, total_segments, callback_)); |
| 143 audio_parameters_, handle, length, total_segments, callback_)); | 143 audio_thread_.Start( |
| 144 audio_thread_.Start(audio_callback_.get(), socket_handle, "AudioInputDevice"); | 144 audio_callback_.get(), socket_handle, "AudioInputDevice", false); |
| 145 | 145 |
| 146 state_ = RECORDING; | 146 state_ = RECORDING; |
| 147 ipc_->RecordStream(); | 147 ipc_->RecordStream(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void AudioInputDevice::OnVolume(double volume) { | 150 void AudioInputDevice::OnVolume(double volume) { |
| 151 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void AudioInputDevice::OnStateChanged( | 154 void AudioInputDevice::OnStateChanged( |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // with nominal range -1.0 -> +1.0. | 309 // with nominal range -1.0 -> +1.0. |
| 310 audio_bus_->FromInterleaved(memory, audio_bus_->frames(), bytes_per_sample); | 310 audio_bus_->FromInterleaved(memory, audio_bus_->frames(), bytes_per_sample); |
| 311 | 311 |
| 312 // Deliver captured data to the client in floating point format | 312 // Deliver captured data to the client in floating point format |
| 313 // and update the audio-delay measurement. | 313 // and update the audio-delay measurement. |
| 314 capture_callback_->Capture( | 314 capture_callback_->Capture( |
| 315 audio_bus_.get(), audio_delay_milliseconds, volume, key_pressed); | 315 audio_bus_.get(), audio_delay_milliseconds, volume, key_pressed); |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace media | 318 } // namespace media |
| OLD | NEW |