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

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

Issue 2919793002: Detect AudioInputStream muting and propagate to MediaStreamAudioSource. (Closed)
Patch Set: 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
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());
Max Morin 2017/06/02 09:56:05 I think you have to check |state_| here to ensure
ossu-chromium 2017/06/02 10:48:00 Oh, you're probably right. I'll look into it.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698