Bug 1397793 - Revert Mozilla changes to OutputMixer r=jesup
authorPaul Adenot <paul@paul.cx>
Tue, 31 Oct 2017 17:40:19 +0100
changeset 448062 80f8abb62e07c5212409ff2fd9d8c14f7094d65d
parent 448061 3d315303d3761d6c015b209b53d4435b449cda0c
child 448063 f269fb34cee90742d5216c8e489e5f9d651737c8
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1397793
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1397793 - Revert Mozilla changes to OutputMixer r=jesup The MSG provides the reverse stream, and feed it directly to the APM. MozReview-Commit-ID: A6DO407CJkp
media/webrtc/trunk/webrtc/voice_engine/output_mixer.cc
--- a/media/webrtc/trunk/webrtc/voice_engine/output_mixer.cc
+++ b/media/webrtc/trunk/webrtc/voice_engine/output_mixer.cc
@@ -242,21 +242,16 @@ OutputMixer::GetOutputVolumePan(float& l
     left = _panLeft;
     right = _panRight;
     WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,-1),
                  "GetOutputVolumePan() => left=%2.1f, right=%2.1f",
                  left, right);
     return 0;
 }
 
-int OutputMixer::GetOutputChannelCount()
-{
-  return _audioFrame.num_channels_;
-}
-
 int OutputMixer::StartRecordingPlayout(const char* fileName,
                                        const CodecInst* codecInst)
 {
     WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1),
                  "OutputMixer::StartRecordingPlayout(fileName=%s)", fileName);
 
     if (_outputFileRecording)
     {
@@ -472,17 +467,21 @@ OutputMixer::DoOperationsOnCombinedSigna
         }
 
         assert(_audioFrame.num_channels_ == 2);
         AudioFrameOperations::Scale(_panLeft, _panRight, _audioFrame);
     }
 
     // --- Far-end Voice Quality Enhancement (AudioProcessing Module)
     if (feed_data_to_apm) {
-      APMAnalyzeReverseStream(_audioFrame);
+      if (_audioProcessingModulePtr->ProcessReverseStream(&_audioFrame) != 0) {
+        WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
+                     "AudioProcessingModule::ProcessReverseStream() => error");
+        RTC_NOTREACHED();
+      }
     }
 
     // --- External media processing
     {
         rtc::CritScope cs(&_callbackCritSect);
         if (_externalMedia)
         {
             const bool is_stereo = (_audioFrame.num_channels_ == 2);
@@ -499,33 +498,10 @@ OutputMixer::DoOperationsOnCombinedSigna
         }
     }
 
     // --- Measure audio level (0-9) for the combined signal
     _audioLevel.ComputeLevel(_audioFrame);
 
     return 0;
 }
-
-// Brought back by Mozilla so we can insert the reverse stream
-void OutputMixer::APMAnalyzeReverseStream(AudioFrame &audioFrame) {
-  // Convert 44100Hz to 32000Hz since Processing doesn't support 44100
-  // directly.
-  // XXX Bug 1367510 -- convert to 48000?  Or modify Processing to
-  // support 44100 directly? (that's probably the best)
-  AudioFrame *frame = &audioFrame;
-  AudioFrame tempframe;
-  if (frame->sample_rate_hz_ == AudioProcessing::NativeRate::kSampleRate44_1kHz) {
-    tempframe.num_channels_ = 1;
-    tempframe.sample_rate_hz_ = AudioProcessing::NativeRate::kSampleRate32kHz;
-    RemixAndResample(audioFrame, &audioproc_resampler_, &tempframe);
-    frame = &tempframe;
-  }
-
-  if (_audioProcessingModulePtr->ProcessReverseStream(frame) != 0) {
-    WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId,-1),
-                 "AudioProcessingModule::ProcessReverseStream() => error");
-    RTC_DCHECK(false);
-  }
-}
-
 }  // namespace voe
 }  // namespace webrtc