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

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

Issue 1211203006: Fixes issue where Web Speech API drops a frame every 5.1 seconds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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_controller.h" 5 #include "media/audio/audio_input_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 this, 552 this,
553 average_power_dbfs, 553 average_power_dbfs,
554 mic_volume_percent)); 554 mic_volume_percent));
555 555
556 last_audio_level_log_time_ = base::TimeTicks::Now(); 556 last_audio_level_log_time_ = base::TimeTicks::Now();
557 } 557 }
558 #endif 558 #endif
559 return; 559 return;
560 } 560 }
561 561
562 DVLOG(1) << "AIC::OnData: " << source->frames();
563
562 // TODO(henrika): Investigate if we can avoid the extra copy here. 564 // TODO(henrika): Investigate if we can avoid the extra copy here.
563 // (see http://crbug.com/249316 for details). AFAIK, this scope is only 565 // (see http://crbug.com/249316 for details). AFAIK, this scope is only
564 // active for WebSpeech clients. 566 // active for WebSpeech clients.
565 scoped_ptr<AudioBus> audio_data = 567 scoped_ptr<AudioBus> audio_data =
566 AudioBus::Create(source->channels(), source->frames()); 568 AudioBus::Create(source->channels(), source->frames());
567 source->CopyTo(audio_data.get()); 569 source->CopyTo(audio_data.get());
568 570
569 // Ownership of the audio buffer will be with the callback until it is run, 571 // Ownership of the audio buffer will be with the callback until it is run,
570 // when ownership is passed to the callback function. 572 // when ownership is passed to the callback function.
571 task_runner_->PostTask( 573 task_runner_->PostTask(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 672 }
671 673
672 void AudioInputController::LogSilenceState(SilenceState value) { 674 void AudioInputController::LogSilenceState(SilenceState value) {
673 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport", 675 UMA_HISTOGRAM_ENUMERATION("Media.AudioInputControllerSessionSilenceReport",
674 value, 676 value,
675 SILENCE_STATE_MAX + 1); 677 SILENCE_STATE_MAX + 1);
676 } 678 }
677 #endif 679 #endif
678 680
679 } // namespace media 681 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698