From 4d363ae305fa975e7f3ad2a5ca5dbe5e3f101f82 Mon Sep 17 00:00:00 2001 From: "henrik.lundin@webrtc.org" Date: Tue, 13 May 2014 08:50:02 +0000 Subject: [PATCH] The webrtc::AudioFrame struct contains a variable energy_. Since the energy isn't always calculated when the frame is created, this change makes the CalculateEnergy method in Audio Conference Mixer always calculate the energy. This part of the the aftermath of issue 3255. BUG=3255 R=andrew@webrtc.org, henrike@webrtc.org, turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/16479004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6117 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../audio_conference_mixer/source/audio_frame_manipulator.cc | 4 ---- webrtc/modules/interface/module_common_types.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc b/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc index 679d608f50..3dce5c8bea 100644 --- a/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc +++ b/webrtc/modules/audio_conference_mixer/source/audio_frame_manipulator.cc @@ -41,10 +41,6 @@ const int rampSize = sizeof(rampArray)/sizeof(rampArray[0]); namespace webrtc { void CalculateEnergy(AudioFrame& audioFrame) { - if(audioFrame.energy_ != 0xffffffff) - { - return; - } audioFrame.energy_ = 0; for(int position = 0; position < audioFrame.samples_per_channel_; position++) diff --git a/webrtc/modules/interface/module_common_types.h b/webrtc/modules/interface/module_common_types.h index 2fcfad1444..d336ccf7cd 100644 --- a/webrtc/modules/interface/module_common_types.h +++ b/webrtc/modules/interface/module_common_types.h @@ -691,6 +691,10 @@ class AudioFrame { int num_channels_; SpeechType speech_type_; VADActivity vad_activity_; + // Note that there is no guarantee that |energy_| is correct. Any user of this + // member must verify that the value is correct. + // TODO(henrike) Remove |energy_|. + // See https://code.google.com/p/webrtc/issues/detail?id=3315. uint32_t energy_; bool interleaved_;