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

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

Issue 146923002: Revert 246894 "Wire up AGC to the MediaStreamAudioProcessor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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;
482 while (audio_processor->ProcessAndConsumeData( 481 while (audio_processor->ProcessAndConsumeData(
483 audio_delay, current_volume, key_pressed, &new_volume, &output)) { 482 audio_delay, current_volume, key_pressed, &output)) {
484 // Feed the post-processed data to the tracks. 483 // Feed the post-processed data to the tracks.
485 for (TrackList::ItemList::const_iterator it = tracks.begin(); 484 for (TrackList::ItemList::const_iterator it = tracks.begin();
486 it != tracks.end(); ++it) { 485 it != tracks.end(); ++it) {
487 (*it)->Capture(output, audio_delay, current_volume, key_pressed, 486 (*it)->Capture(output, audio_delay, current_volume, key_pressed,
488 need_audio_processing); 487 need_audio_processing);
489 } 488 }
490 489 // TODO(xians): Apply the new volume after AGC is working with the
491 if (new_volume) { 490 // MediaStreamAudioProcessor.
492 SetVolume(new_volume);
493
494 // Update the |current_volume| to avoid passing the old volume to AGC.
495 current_volume = new_volume;
496 }
497 } 491 }
498 } 492 }
499 493
500 void WebRtcAudioCapturer::OnCaptureError() { 494 void WebRtcAudioCapturer::OnCaptureError() {
501 NOTIMPLEMENTED(); 495 NOTIMPLEMENTED();
502 } 496 }
503 497
504 media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const { 498 media::AudioParameters WebRtcAudioCapturer::source_audio_parameters() const {
505 base::AutoLock auto_lock(lock_); 499 base::AutoLock auto_lock(lock_);
506 return audio_processor_ ? 500 return audio_processor_ ?
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 const scoped_refptr<media::AudioCapturerSource>& source, 575 const scoped_refptr<media::AudioCapturerSource>& source,
582 media::AudioParameters params) { 576 media::AudioParameters params) {
583 // Create a new audio stream as source which uses the new source. 577 // Create a new audio stream as source which uses the new source.
584 SetCapturerSource(source, params.channel_layout(), 578 SetCapturerSource(source, params.channel_layout(),
585 static_cast<float>(params.sample_rate()), 579 static_cast<float>(params.sample_rate()),
586 params.effects(), 580 params.effects(),
587 constraints_); 581 constraints_);
588 } 582 }
589 583
590 } // namespace content 584 } // 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