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

Unified Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 1772583002: Delete VAD methods from AcmReceiver and move functionality inside NetEq (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-getaudio-frame
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index 02d165a2d5a11a9c72cfc45af7cae96a612696d0..1990768bc7d6278375bc6840be08803236fba21c 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
@@ -35,77 +35,6 @@ namespace acm2 {
namespace {
-// |vad_activity_| field of |audio_frame| is set to |previous_audio_activity_|
-// before the call to this function.
-void SetAudioFrameActivityAndType(bool vad_enabled,
- NetEqOutputType type,
- AudioFrame* audio_frame) {
- if (vad_enabled) {
- switch (type) {
- case kOutputNormal: {
- audio_frame->vad_activity_ = AudioFrame::kVadActive;
- audio_frame->speech_type_ = AudioFrame::kNormalSpeech;
- break;
- }
- case kOutputVADPassive: {
- audio_frame->vad_activity_ = AudioFrame::kVadPassive;
- audio_frame->speech_type_ = AudioFrame::kNormalSpeech;
- break;
- }
- case kOutputCNG: {
- audio_frame->vad_activity_ = AudioFrame::kVadPassive;
- audio_frame->speech_type_ = AudioFrame::kCNG;
- break;
- }
- case kOutputPLC: {
- // Don't change |audio_frame->vad_activity_|, it should be the same as
- // |previous_audio_activity_|.
- audio_frame->speech_type_ = AudioFrame::kPLC;
- break;
- }
- case kOutputPLCtoCNG: {
- audio_frame->vad_activity_ = AudioFrame::kVadPassive;
- audio_frame->speech_type_ = AudioFrame::kPLCCNG;
- break;
- }
- default:
- assert(false);
- }
- } else {
- // Always return kVadUnknown when receive VAD is inactive
- audio_frame->vad_activity_ = AudioFrame::kVadUnknown;
- switch (type) {
- case kOutputNormal: {
- audio_frame->speech_type_ = AudioFrame::kNormalSpeech;
- break;
- }
- case kOutputCNG: {
- audio_frame->speech_type_ = AudioFrame::kCNG;
- break;
- }
- case kOutputPLC: {
- audio_frame->speech_type_ = AudioFrame::kPLC;
- break;
- }
- case kOutputPLCtoCNG: {
- audio_frame->speech_type_ = AudioFrame::kPLCCNG;
- break;
- }
- case kOutputVADPassive: {
- // Normally, we should no get any VAD decision if post-decoding VAD is
- // not active. However, if post-decoding VAD has been active then
- // disabled, we might be here for couple of frames.
- audio_frame->speech_type_ = AudioFrame::kNormalSpeech;
- LOG(WARNING) << "Post-decoding VAD is disabled but output is "
- << "labeled VAD-passive";
- break;
- }
- default:
- assert(false);
- }
- }
-}
-
// Is the given codec a CNG codec?
// TODO(kwiberg): Move to RentACodec.
bool IsCng(int codec_id) {
@@ -120,10 +49,8 @@ bool IsCng(int codec_id) {
AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
: last_audio_decoder_(nullptr),
- previous_audio_activity_(AudioFrame::kVadPassive),
last_audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]),
neteq_(NetEq::Create(config.neteq_config)),
- vad_enabled_(config.neteq_config.enable_post_decode_vad),
clock_(config.clock),
resampled_last_output_frame_(true) {
assert(clock_);
@@ -264,10 +191,6 @@ int AcmReceiver::GetAudio(int desired_freq_hz, AudioFrame* audio_frame) {
sizeof(int16_t) * audio_frame->samples_per_channel_ *
audio_frame->num_channels_);
- // Should set |vad_activity| before calling SetAudioFrameActivityAndType().
- audio_frame->vad_activity_ = previous_audio_activity_;
- SetAudioFrameActivityAndType(vad_enabled_, type, audio_frame);
- previous_audio_activity_ = audio_frame->vad_activity_;
call_stats_.DecodedByNetEq(audio_frame->speech_type_);
// Computes the RTP timestamp of the first sample in |audio_frame| from
@@ -351,18 +274,6 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
return 0;
}
-void AcmReceiver::EnableVad() {
- neteq_->EnableVad();
- rtc::CritScope lock(&crit_sect_);
- vad_enabled_ = true;
-}
-
-void AcmReceiver::DisableVad() {
- neteq_->DisableVad();
- rtc::CritScope lock(&crit_sect_);
- vad_enabled_ = false;
-}
-
void AcmReceiver::FlushBuffers() {
neteq_->FlushBuffers();
}

Powered by Google App Engine
This is Rietveld 408576698