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

Side by Side Diff: trunk/src/content/renderer/media/webrtc_audio_capturer.cc

Issue 148213002: Revert 246905 "Revert 246894 "Wire up AGC to the MediaStreamAudi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/content/renderer/media/media_stream_audio_processor_unittest.cc ('k') | no next file » | 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/renderer/media/webrtc_audio_capturer.h" 5 #include "content/renderer/media/webrtc_audio_capturer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 it != tracks_to_notify_format.end(); ++it) { 471 it != tracks_to_notify_format.end(); ++it) {
472 (*it)->OnSetFormat(output_params); 472 (*it)->OnSetFormat(output_params);
473 } 473 }
474 474
475 // Push the data to the processor for processing. 475 // Push the data to the processor for processing.
476 audio_processor->PushCaptureData(audio_source); 476 audio_processor->PushCaptureData(audio_source);
477 477
478 // Process and consume the data in the processor until there is not enough 478 // Process and consume the data in the processor until there is not enough
479 // data in the processor. 479 // data in the processor.
480 int16* output = NULL; 480 int16* output = NULL;
481 int new_volume = 0;
481 while (audio_processor->ProcessAndConsumeData( 482 while (audio_processor->ProcessAndConsumeData(
482 audio_delay, current_volume, key_pressed, &output)) { 483 audio_delay, current_volume, key_pressed, &new_volume, &output)) {
483 // Feed the post-processed data to the tracks. 484 // Feed the post-processed data to the tracks.
484 for (TrackList::ItemList::const_iterator it = tracks.begin(); 485 for (TrackList::ItemList::const_iterator it = tracks.begin();
485 it != tracks.end(); ++it) { 486 it != tracks.end(); ++it) {
486 (*it)->Capture(output, audio_delay, current_volume, key_pressed, 487 (*it)->Capture(output, audio_delay, current_volume, key_pressed,
487 need_audio_processing); 488 need_audio_processing);
488 } 489 }
489 // TODO(xians): Apply the new volume after AGC is working with the 490
490 // MediaStreamAudioProcessor. 491 if (new_volume) {
492 SetVolume(new_volume);
493
494 // Update the |current_volume| to avoid passing the old volume to AGC.
495 current_volume = new_volume;
496 }
491 } 497 }
492 } 498 }
493 499
494 void WebRtcAudioCapturer::OnCaptureError() { 500 void WebRtcAudioCapturer::OnCaptureError() {
495 NOTIMPLEMENTED(); 501 NOTIMPLEMENTED();
496 } 502 }
497 503
498 media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const { 504 media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const {
499 base::AutoLock auto_lock(lock_); 505 base::AutoLock auto_lock(lock_);
500 return audio_processor_ ? 506 return audio_processor_ ?
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 const scoped_refptr<media::AudioCapturerSource>& source, 581 const scoped_refptr<media::AudioCapturerSource>& source,
576 media::AudioParameters params) { 582 media::AudioParameters params) {
577 // Create a new audio stream as source which uses the new source. 583 // Create a new audio stream as source which uses the new source.
578 SetCapturerSource(source, params.channel_layout(), 584 SetCapturerSource(source, params.channel_layout(),
579 static_cast<float>(params.sample_rate()), 585 static_cast<float>(params.sample_rate()),
580 params.effects(), 586 params.effects(),
581 constraints_); 587 constraints_);
582 } 588 }
583 589
584 } // namespace content 590 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/content/renderer/media/media_stream_audio_processor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698