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

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

Issue 2941773002: Added initial muted state to stream creation callback, to avoid races. (Closed)
Patch Set: Added mute information to DoCompleteCreation log message. 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_controller.h ('k') | media/audio/audio_input_controller_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_controller.h" 5 #include "media/audio/audio_input_controller.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // lower level. AGC can fail on platforms where we don't support the 352 // lower level. AGC can fail on platforms where we don't support the
353 // functionality to modify the input volume slider. One such example is 353 // functionality to modify the input volume slider. One such example is
354 // Windows XP. 354 // Windows XP.
355 power_measurement_is_enabled_ &= agc_is_supported; 355 power_measurement_is_enabled_ &= agc_is_supported;
356 #else 356 #else
357 stream_to_control->SetAutomaticGainControl(enable_agc); 357 stream_to_control->SetAutomaticGainControl(enable_agc);
358 #endif 358 #endif
359 359
360 // Finally, keep the stream pointer around, update the state and notify. 360 // Finally, keep the stream pointer around, update the state and notify.
361 stream_ = stream_to_control; 361 stream_ = stream_to_control;
362 handler_->OnCreated(this);
363 362
364 // Check the current muted state and start the repeating timer to keep that 363 // Send initial muted state along with OnCreated, to avoid races.
365 // updated. 364 is_muted_ = stream_->IsMuted();
366 CheckMutedState(); 365 handler_->OnCreated(this, is_muted_);
366
367 check_muted_state_timer_.Start( 367 check_muted_state_timer_.Start(
368 FROM_HERE, base::TimeDelta::FromSeconds(kCheckMutedStateIntervalSeconds), 368 FROM_HERE, base::TimeDelta::FromSeconds(kCheckMutedStateIntervalSeconds),
369 this, &AudioInputController::CheckMutedState); 369 this, &AudioInputController::CheckMutedState);
370 DCHECK(check_muted_state_timer_.IsRunning()); 370 DCHECK(check_muted_state_timer_.IsRunning());
371 } 371 }
372 372
373 void AudioInputController::DoRecord() { 373 void AudioInputController::DoRecord() {
374 DCHECK(task_runner_->BelongsToCurrentThread()); 374 DCHECK(task_runner_->BelongsToCurrentThread());
375 SCOPED_UMA_HISTOGRAM_TIMER("Media.AudioInputController.RecordTime"); 375 SCOPED_UMA_HISTOGRAM_TIMER("Media.AudioInputController.RecordTime");
376 376
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 case AudioParameters::Format::AUDIO_PCM_LOW_LATENCY: 698 case AudioParameters::Format::AUDIO_PCM_LOW_LATENCY:
699 return AudioInputController::StreamType::LOW_LATENCY; 699 return AudioInputController::StreamType::LOW_LATENCY;
700 default: 700 default:
701 // Currently, the remaining supported type is fake. Reconsider if other 701 // Currently, the remaining supported type is fake. Reconsider if other
702 // formats become supported. 702 // formats become supported.
703 return AudioInputController::StreamType::FAKE; 703 return AudioInputController::StreamType::FAKE;
704 } 704 }
705 } 705 }
706 706
707 } // namespace media 707 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | media/audio/audio_input_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698