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