Remove the use of AudioFrame::energy_ from AudioProcessing and VoE.
We want to remove energy_ entirely as we've seen that carrying around this potentially invalid value is dangerous. Results in the removal of AudioBuffer::is_muted(). This wasn't used in practice any longer, after the level calculation moved directly to channel.cc Instead, now use ProcessMuted() in channel.cc, to shortcut the level computation when the signal is muted. BUG=3315 TESTED=Muting the channel in voe_cmd_test results in rms=127. R=bjornv@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12529004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6159 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -72,7 +72,6 @@ void AudioFrameOperations::SwapStereoChannels(AudioFrame* frame) {
|
||||
void AudioFrameOperations::Mute(AudioFrame& frame) {
|
||||
memset(frame.data_, 0, sizeof(int16_t) *
|
||||
frame.samples_per_channel_ * frame.num_channels_);
|
||||
frame.energy_ = 0;
|
||||
}
|
||||
|
||||
int AudioFrameOperations::Scale(float left, float right, AudioFrame& frame) {
|
||||
|
||||
@ -142,17 +142,13 @@ TEST_F(AudioFrameOperationsTest, SwapStereoChannelsFailsOnMono) {
|
||||
|
||||
TEST_F(AudioFrameOperationsTest, MuteSucceeds) {
|
||||
SetFrameData(&frame_, 1000, 1000);
|
||||
frame_.energy_ = 1000 * 1000 * frame_.samples_per_channel_ *
|
||||
frame_.num_channels_;
|
||||
AudioFrameOperations::Mute(frame_);
|
||||
|
||||
AudioFrame muted_frame;
|
||||
muted_frame.samples_per_channel_ = 320;
|
||||
muted_frame.num_channels_ = 2;
|
||||
SetFrameData(&muted_frame, 0, 0);
|
||||
muted_frame.energy_ = 0;
|
||||
VerifyFramesAreEqual(muted_frame, frame_);
|
||||
EXPECT_EQ(muted_frame.energy_, frame_.energy_);
|
||||
}
|
||||
|
||||
// TODO(andrew): should not allow negative scales.
|
||||
|
||||
Reference in New Issue
Block a user