Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: media/audio/audio_input_device.cc

Issue 2919793002: Detect AudioInputStream muting and propagate to MediaStreamAudioSource. (Closed)
Patch Set: Reworked test again, to make tsan2 happy. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/audio_input_device.h ('k') | media/audio/audio_input_device_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Do nothing if the stream has been closed.
231 if (state_ < CREATING_STREAM)
232 return;
233 callback_->OnCaptureMuted(is_muted);
234 }
235
228 void AudioInputDevice::OnIPCClosed() { 236 void AudioInputDevice::OnIPCClosed() {
229 DCHECK(task_runner()->BelongsToCurrentThread()); 237 DCHECK(task_runner()->BelongsToCurrentThread());
230 state_ = IPC_CLOSED; 238 state_ = IPC_CLOSED;
231 ipc_.reset(); 239 ipc_.reset();
232 } 240 }
233 241
234 AudioInputDevice::~AudioInputDevice() { 242 AudioInputDevice::~AudioInputDevice() {
235 #if DCHECK_IS_ON() 243 #if DCHECK_IS_ON()
236 // Make sure we've stopped the stream properly before destructing |this|. 244 // Make sure we've stopped the stream properly before destructing |this|.
237 DCHECK(audio_thread_lock_.Try()); 245 DCHECK(audio_thread_lock_.Try());
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 capture_callback_->Capture( 436 capture_callback_->Capture(
429 audio_bus, 437 audio_bus,
430 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms 438 buffer->params.hardware_delay_bytes / bytes_per_ms_, // Delay in ms
431 buffer->params.volume, buffer->params.key_pressed); 439 buffer->params.volume, buffer->params.key_pressed);
432 440
433 if (++current_segment_id_ >= total_segments_) 441 if (++current_segment_id_ >= total_segments_)
434 current_segment_id_ = 0; 442 current_segment_id_ = 0;
435 } 443 }
436 444
437 } // namespace media 445 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_device.h ('k') | media/audio/audio_input_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698