| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 LOG(ERROR) << "IO loop going away before the input device has been stopped"; | 296 LOG(ERROR) << "IO loop going away before the input device has been stopped"; |
| 297 ShutDownOnIOThread(); | 297 ShutDownOnIOThread(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 // AudioInputDevice::AudioThreadCallback | 300 // AudioInputDevice::AudioThreadCallback |
| 301 AudioInputDevice::AudioThreadCallback::AudioThreadCallback( | 301 AudioInputDevice::AudioThreadCallback::AudioThreadCallback( |
| 302 const AudioParameters& audio_parameters, | 302 const AudioParameters& audio_parameters, |
| 303 base::SharedMemoryHandle memory, | 303 base::SharedMemoryHandle memory, |
| 304 int memory_length, | 304 int memory_length, |
| 305 CaptureCallback* capture_callback) | 305 CaptureCallback* capture_callback) |
| 306 : AudioDeviceThread::Callback(audio_parameters, 0, memory, memory_length), | 306 : AudioDeviceThread::Callback(audio_parameters, memory, memory_length), |
| 307 capture_callback_(capture_callback) { | 307 capture_callback_(capture_callback) { |
| 308 audio_bus_ = AudioBus::Create(audio_parameters_); | 308 audio_bus_ = AudioBus::Create(audio_parameters_); |
| 309 } | 309 } |
| 310 | 310 |
| 311 AudioInputDevice::AudioThreadCallback::~AudioThreadCallback() { | 311 AudioInputDevice::AudioThreadCallback::~AudioThreadCallback() { |
| 312 } | 312 } |
| 313 | 313 |
| 314 void AudioInputDevice::AudioThreadCallback::MapSharedMemory() { | 314 void AudioInputDevice::AudioThreadCallback::MapSharedMemory() { |
| 315 shared_memory_.Map(memory_length_); | 315 shared_memory_.Map(memory_length_); |
| 316 } | 316 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 333 // with nominal range -1.0 -> +1.0. | 333 // with nominal range -1.0 -> +1.0. |
| 334 audio_bus_->FromInterleaved(memory, audio_bus_->frames(), bytes_per_sample); | 334 audio_bus_->FromInterleaved(memory, audio_bus_->frames(), bytes_per_sample); |
| 335 | 335 |
| 336 // Deliver captured data to the client in floating point format | 336 // Deliver captured data to the client in floating point format |
| 337 // and update the audio-delay measurement. | 337 // and update the audio-delay measurement. |
| 338 capture_callback_->Capture(audio_bus_.get(), | 338 capture_callback_->Capture(audio_bus_.get(), |
| 339 audio_delay_milliseconds, volume); | 339 audio_delay_milliseconds, volume); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace media | 342 } // namespace media |
| OLD | NEW |