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 <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // object has been deleted. | 218 // object has been deleted. |
219 // TODO(tommi): Add an explicit contract for clearing the callback | 219 // TODO(tommi): Add an explicit contract for clearing the callback |
220 // object. Possibly require calling Initialize again or provide | 220 // object. Possibly require calling Initialize again or provide |
221 // a callback object via Start() and clear it in Stop(). | 221 // a callback object via Start() and clear it in Stop(). |
222 base::AutoLock auto_lock_(audio_thread_lock_); | 222 base::AutoLock auto_lock_(audio_thread_lock_); |
223 if (audio_thread_) | 223 if (audio_thread_) |
224 callback_->OnCaptureError("IPC delegate state error."); | 224 callback_->OnCaptureError("IPC delegate state error."); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
| 228 void AudioInputDevice::OnMuted(bool is_muted) { |
| 229 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 230 callback_->OnCaptureMuted(is_muted); |
| 231 } |
| 232 |
228 void AudioInputDevice::OnIPCClosed() { | 233 void AudioInputDevice::OnIPCClosed() { |
229 DCHECK(task_runner()->BelongsToCurrentThread()); | 234 DCHECK(task_runner()->BelongsToCurrentThread()); |
230 state_ = IPC_CLOSED; | 235 state_ = IPC_CLOSED; |
231 ipc_.reset(); | 236 ipc_.reset(); |
232 } | 237 } |
233 | 238 |
234 AudioInputDevice::~AudioInputDevice() { | 239 AudioInputDevice::~AudioInputDevice() { |
235 #if DCHECK_IS_ON() | 240 #if DCHECK_IS_ON() |
236 // Make sure we've stopped the stream properly before destructing |this|. | 241 // Make sure we've stopped the stream properly before destructing |this|. |
237 DCHECK(audio_thread_lock_.Try()); | 242 DCHECK(audio_thread_lock_.Try()); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 capture_callback_->Capture( | 433 capture_callback_->Capture( |
429 audio_bus, | 434 audio_bus, |
430 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms | 435 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms |
431 buffer->params.volume, buffer->params.key_pressed); | 436 buffer->params.volume, buffer->params.key_pressed); |
432 | 437 |
433 if (++current_segment_id_ >= total_segments_) | 438 if (++current_segment_id_ >= total_segments_) |
434 current_segment_id_ = 0; | 439 current_segment_id_ = 0; |
435 } | 440 } |
436 | 441 |
437 } // namespace media | 442 } // namespace media |
OLD | NEW |