summaryrefslogtreecommitdiff
path: root/voice_engine/channel.cc
diff options
context:
space:
mode:
authorandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-05 18:22:21 +0000
committerandrew@webrtc.org <andrew@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-05-05 18:22:21 +0000
commit3cd0f7c23453b72575e9c92bb7144fa3525abb10 (patch)
tree3b121fc1a32c141a60bed22e74233da622f3e922 /voice_engine/channel.cc
parent60c62f8a7626a02356384e9a0a15a179f1b1f9d6 (diff)
downloadwebrtc-3cd0f7c23453b72575e9c92bb7144fa3525abb10.tar.gz
Allow the RTP level indicator computation to work at any sample rate.
Break out the computation to a separate class, and call directly into this from channel.cc rather than going through AudioProcessing. This circumvents AudioProcessing's sample rate limitations. We now compute the RMS over all samples rather than downmixing to a single channel. This makes the call point in channel.cc easier, is more "correct" and should have similar (negligible) complexity. This caused slight changes in the RMS output, so the ApmTest.Process reference has been updated. Snippet of the failing output: [ RUN ] ApmTest.Process Running test 4 of 12... Value of: rms_level Actual: 27 Expected: test->rms_level() Which is: 28 Running test 5 of 12... Value of: rms_level Actual: 26 Expected: test->rms_level() Which is: 27 Running test 6 of 12... Value of: rms_level Actual: 26 Expected: test->rms_level() Which is: 27 Running test 10 of 12... Value of: rms_level Actual: 27 Expected: test->rms_level() Which is: 28 Running test 11 of 12... Value of: rms_level Actual: 26 Expected: test->rms_level() Which is: 27 Running test 12 of 12... Value of: rms_level Actual: 26 Expected: test->rms_level() Which is: 27 BUG=3290 TESTED=Chrome assert is avoided and both voe_cmd_test and apprtc produce reasonable printed out results from RMS(). R=bjornv@webrtc.org Review URL: https://webrtc-codereview.appspot.com/16459004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6056 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/channel.cc')
-rw-r--r--voice_engine/channel.cc23
1 files changed, 3 insertions, 20 deletions
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index b3c53f85..ebb3290b 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -106,7 +106,7 @@ Channel::SendData(FrameType frameType,
// Store current audio level in the RTP/RTCP module.
// The level will be used in combination with voice-activity state
// (frameType) to add an RTP header extension
- _rtpRtcpModule->SetAudioLevel(rtp_audioproc_->level_estimator()->RMS());
+ _rtpRtcpModule->SetAudioLevel(rms_level_.RMS());
}
// Push data from ACM to RTP/RTCP-module to deliver audio frame for
@@ -3220,20 +3220,7 @@ Channel::GetRemoteCSRCs(unsigned int arrCSRC[15])
}
int Channel::SetSendAudioLevelIndicationStatus(bool enable, unsigned char id) {
- if (rtp_audioproc_.get() == NULL) {
- rtp_audioproc_.reset(AudioProcessing::Create(VoEModuleId(_instanceId,
- _channelId)));
- }
-
- if (rtp_audioproc_->level_estimator()->Enable(enable) !=
- AudioProcessing::kNoError) {
- _engineStatisticsPtr->SetLastError(VE_APM_ERROR, kTraceError,
- "Failed to enable AudioProcessing::level_estimator()");
- return -1;
- }
-
_includeAudioLevelIndication = enable;
-
return SetSendRtpHeaderExtension(enable, kRtpExtensionAudioLevel, id);
}
@@ -3936,12 +3923,8 @@ Channel::PrepareEncodeAndSend(int mixingFrequency)
InsertInbandDtmfTone();
if (_includeAudioLevelIndication) {
- // Performs level analysis only; does not affect the signal.
- int err = rtp_audioproc_->ProcessStream(&_audioFrame);
- if (err) {
- LOG(LS_ERROR) << "ProcessStream() error: " << err;
- assert(false);
- }
+ int length = _audioFrame.samples_per_channel_ * _audioFrame.num_channels_;
+ rms_level_.Process(_audioFrame.data_, length);
}
return 0;