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

Side by Side Diff: content/browser/renderer_host/media/audio_input_renderer_host.cc

Issue 663123002: Reduce power logging and UMA stats when AGC is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 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 "content/browser/renderer_host/media/audio_input_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/numerics/safe_math.h" 10 #include "base/numerics/safe_math.h"
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 audio_manager_->GetTaskRunner(), 382 audio_manager_->GetTaskRunner(),
383 this, 383 this,
384 WebContentsAudioInputStream::Create( 384 WebContentsAudioInputStream::Create(
385 device_id, 385 device_id,
386 audio_params, 386 audio_params,
387 audio_manager_->GetWorkerTaskRunner(), 387 audio_manager_->GetWorkerTaskRunner(),
388 audio_mirroring_manager_), 388 audio_mirroring_manager_),
389 entry->writer.get(), 389 entry->writer.get(),
390 user_input_monitor_); 390 user_input_monitor_);
391 } else { 391 } else {
392 // TODO(henrika): replace CreateLowLatency() with Create() as soon 392 // Set the initial AGC state for the audio input stream. Note that, the AGC
393 // as satish has ensured that Speech Input also uses the default low- 393 // is only supported in AUDIO_PCM_LOW_LATENCY mode.
394 // latency path. See crbug.com/112472 for details. 394 const bool agc_is_enabled =
395 config.params.format() ==
396 media::AudioParameters::AUDIO_PCM_LOW_LATENCY &&
tommi (sloooow) - chröme 2014/10/20 16:03:28 if format() is not 'low latency' bug we call Creat
henrika (OOO until Aug 14) 2014/10/21 08:00:28 Good point. I had the same idea but did not want t
397 config.automatic_gain_control;
398 oss << ", AGC=" << agc_is_enabled;
395 entry->controller = 399 entry->controller =
396 media::AudioInputController::CreateLowLatency(audio_manager_, 400 media::AudioInputController::CreateLowLatency(audio_manager_,
397 this, 401 this,
398 audio_params, 402 audio_params,
399 device_id, 403 device_id,
400 entry->writer.get(), 404 entry->writer.get(),
401 user_input_monitor_); 405 user_input_monitor_,
406 agc_is_enabled);
402 } 407 }
403 408
404 if (!entry->controller.get()) { 409 if (!entry->controller.get()) {
405 SendErrorMessage(stream_id, STREAM_CREATE_ERROR); 410 SendErrorMessage(stream_id, STREAM_CREATE_ERROR);
406 MaybeUnregisterKeyboardMicStream(config); 411 MaybeUnregisterKeyboardMicStream(config);
407 return; 412 return;
408 } 413 }
409 414
410 // Set the initial AGC state for the audio input stream. Note that, the AGC
411 // is only supported in AUDIO_PCM_LOW_LATENCY mode.
412 if (config.params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY) {
413 entry->controller->SetAutomaticGainControl(config.automatic_gain_control);
414 oss << ", AGC=" << config.automatic_gain_control;
415 }
416
417 #if defined(OS_CHROMEOS) 415 #if defined(OS_CHROMEOS)
418 if (config.params.channel_layout() == 416 if (config.params.channel_layout() ==
419 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { 417 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) {
420 entry->has_keyboard_mic_ = true; 418 entry->has_keyboard_mic_ = true;
421 } 419 }
422 #endif 420 #endif
423 421
424 MediaStreamManager::SendMessageToNativeLog(oss.str()); 422 MediaStreamManager::SendMessageToNativeLog(oss.str());
425 DVLOG(1) << oss.str(); 423 DVLOG(1) << oss.str();
426 424
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 #if defined(OS_CHROMEOS) 554 #if defined(OS_CHROMEOS)
557 if (config.params.channel_layout() == 555 if (config.params.channel_layout() ==
558 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { 556 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) {
559 media_stream_manager_->audio_input_device_manager() 557 media_stream_manager_->audio_input_device_manager()
560 ->UnregisterKeyboardMicStream(); 558 ->UnregisterKeyboardMicStream();
561 } 559 }
562 #endif 560 #endif
563 } 561 }
564 562
565 } // namespace content 563 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_input_controller.h » ('j') | media/audio/audio_input_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698