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

Side by Side Diff: webrtc/voice_engine/output_mixer.cc

Issue 1234463003: Integrate Intelligibility with APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix Mac Error (3) Created 5 years, 4 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 | « webrtc/voice_engine/output_mixer.h ('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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 { 511 {
512 // Pure stereo mode (we are receiving a stereo signal). 512 // Pure stereo mode (we are receiving a stereo signal).
513 } 513 }
514 514
515 assert(_audioFrame.num_channels_ == 2); 515 assert(_audioFrame.num_channels_ == 2);
516 AudioFrameOperations::Scale(_panLeft, _panRight, _audioFrame); 516 AudioFrameOperations::Scale(_panLeft, _panRight, _audioFrame);
517 } 517 }
518 518
519 // --- Far-end Voice Quality Enhancement (AudioProcessing Module) 519 // --- Far-end Voice Quality Enhancement (AudioProcessing Module)
520 if (feed_data_to_apm) 520 if (feed_data_to_apm)
521 APMAnalyzeReverseStream(); 521 APMProcessReverseStream();
522 522
523 // --- External media processing 523 // --- External media processing
524 { 524 {
525 CriticalSectionScoped cs(&_callbackCritSect); 525 CriticalSectionScoped cs(&_callbackCritSect);
526 if (_externalMedia) 526 if (_externalMedia)
527 { 527 {
528 const bool is_stereo = (_audioFrame.num_channels_ == 2); 528 const bool is_stereo = (_audioFrame.num_channels_ == 2);
529 if (_externalMediaCallbackPtr) 529 if (_externalMediaCallbackPtr)
530 { 530 {
531 _externalMediaCallbackPtr->Process( 531 _externalMediaCallbackPtr->Process(
(...skipping 10 matching lines...) Expand all
542 // --- Measure audio level (0-9) for the combined signal 542 // --- Measure audio level (0-9) for the combined signal
543 _audioLevel.ComputeLevel(_audioFrame); 543 _audioLevel.ComputeLevel(_audioFrame);
544 544
545 return 0; 545 return 0;
546 } 546 }
547 547
548 // ---------------------------------------------------------------------------- 548 // ----------------------------------------------------------------------------
549 // Private methods 549 // Private methods
550 // ---------------------------------------------------------------------------- 550 // ----------------------------------------------------------------------------
551 551
552 void OutputMixer::APMAnalyzeReverseStream() { 552 void OutputMixer::APMProcessReverseStream() {
553 // Convert from mixing to AudioProcessing sample rate, determined by the send 553 if (_audioProcessingModulePtr->ProcessReverseStream(&_audioFrame) == -1) {
554 // side. Downmix to mono. 554 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, -1),
555 AudioFrame frame; 555 "AudioProcessingModule::ProcessReverseStream() => error");
556 frame.num_channels_ = 1;
557 frame.sample_rate_hz_ = _audioProcessingModulePtr->input_sample_rate_hz();
558 RemixAndResample(_audioFrame, &audioproc_resampler_, &frame);
559
560 if (_audioProcessingModulePtr->AnalyzeReverseStream(&frame) == -1) {
561 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
562 "AudioProcessingModule::AnalyzeReverseStream() => error");
563 } 556 }
564 } 557 }
565 558
566 int 559 int
567 OutputMixer::InsertInbandDtmfTone() 560 OutputMixer::InsertInbandDtmfTone()
568 { 561 {
569 uint16_t sampleRate(0); 562 uint16_t sampleRate(0);
570 _dtmfGenerator.GetSampleRate(sampleRate); 563 _dtmfGenerator.GetSampleRate(sampleRate);
571 if (sampleRate != _audioFrame.sample_rate_hz_) 564 if (sampleRate != _audioFrame.sample_rate_hz_)
572 { 565 {
(...skipping 29 matching lines...) Expand all
602 _audioFrame.data_[2 * i + 1] = 0; 595 _audioFrame.data_[2 * i + 1] = 0;
603 } 596 }
604 } 597 }
605 assert(_audioFrame.samples_per_channel_ == toneSamples); 598 assert(_audioFrame.samples_per_channel_ == toneSamples);
606 599
607 return 0; 600 return 0;
608 } 601 }
609 602
610 } // namespace voe 603 } // namespace voe
611 } // namespace webrtc 604 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/output_mixer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698