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

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: rebased 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
« no previous file with comments | « no previous file | media/audio/audio_input_controller.h » ('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 "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 DCHECK_EQ(config.params.format(),
393 // as satish has ensured that Speech Input also uses the default low- 393 media::AudioParameters::AUDIO_PCM_LOW_LATENCY);
394 // latency path. See crbug.com/112472 for details. 394 entry->controller = media::AudioInputController::CreateLowLatency(
395 entry->controller = 395 audio_manager_,
396 media::AudioInputController::CreateLowLatency(audio_manager_, 396 this,
397 this, 397 audio_params,
398 audio_params, 398 device_id,
399 device_id, 399 entry->writer.get(),
400 entry->writer.get(), 400 user_input_monitor_,
401 user_input_monitor_); 401 config.automatic_gain_control);
402 oss << ", AGC=" << config.automatic_gain_control;
402 } 403 }
403 404
404 if (!entry->controller.get()) { 405 if (!entry->controller.get()) {
405 SendErrorMessage(stream_id, STREAM_CREATE_ERROR); 406 SendErrorMessage(stream_id, STREAM_CREATE_ERROR);
406 MaybeUnregisterKeyboardMicStream(config); 407 MaybeUnregisterKeyboardMicStream(config);
407 return; 408 return;
408 } 409 }
409 410
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) 411 #if defined(OS_CHROMEOS)
418 if (config.params.channel_layout() == 412 if (config.params.channel_layout() ==
419 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { 413 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) {
420 entry->has_keyboard_mic_ = true; 414 entry->has_keyboard_mic_ = true;
421 } 415 }
422 #endif 416 #endif
423 417
424 MediaStreamManager::SendMessageToNativeLog(oss.str()); 418 MediaStreamManager::SendMessageToNativeLog(oss.str());
425 DVLOG(1) << oss.str(); 419 DVLOG(1) << oss.str();
426 420
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 #if defined(OS_CHROMEOS) 550 #if defined(OS_CHROMEOS)
557 if (config.params.channel_layout() == 551 if (config.params.channel_layout() ==
558 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) { 552 media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC) {
559 media_stream_manager_->audio_input_device_manager() 553 media_stream_manager_->audio_input_device_manager()
560 ->UnregisterKeyboardMicStream(); 554 ->UnregisterKeyboardMicStream();
561 } 555 }
562 #endif 556 #endif
563 } 557 }
564 558
565 } // namespace content 559 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_input_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698