From 5fac3f089280bb8f3ad433e8fdf4b52b2d4e0ba5 Mon Sep 17 00:00:00 2001 From: "henrik.lundin" Date: Wed, 24 Aug 2016 11:18:49 -0700 Subject: [PATCH] NetEq: Don't check sample rate and frame size upon error If an error happens in the GetAudio call, for instance when corrupt payloads are inserted, GetAudio wil return an error. In this case, the audio frame is not always correctly populated, which is to be expected. BUG=webrtc:5447 Review-Url: https://codereview.webrtc.org/2272963002 Cr-Commit-Position: refs/heads/master@{#13902} --- webrtc/modules/audio_coding/neteq/include/neteq.h | 2 +- webrtc/modules/audio_coding/neteq/neteq_impl.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webrtc/modules/audio_coding/neteq/include/neteq.h b/webrtc/modules/audio_coding/neteq/include/neteq.h index 1ae7664077..9420cdbac9 100644 --- a/webrtc/modules/audio_coding/neteq/include/neteq.h +++ b/webrtc/modules/audio_coding/neteq/include/neteq.h @@ -165,7 +165,7 @@ class NetEq { // |audio_frame|. All data in |audio_frame| is wiped; |data_|, |speech_type_|, // |num_channels_|, |sample_rate_hz_|, |samples_per_channel_|, and // |vad_activity_| are updated upon success. If an error is returned, some - // fields may not have been updated. + // fields may not have been updated, or may contain inconsistent values. // If muted state is enabled (through Config::enable_muted_state), |muted| // may be set to true after a prolonged expand period. When this happens, the // |data_| in |audio_frame| is not written, but should be interpreted as being diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc index 9cd73b6409..e65466f6d8 100644 --- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc +++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc @@ -206,13 +206,13 @@ int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) { TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio"); rtc::CritScope lock(&crit_sect_); int error = GetAudioInternal(audio_frame, muted); - RTC_DCHECK_EQ( - audio_frame->sample_rate_hz_, - rtc::checked_cast(audio_frame->samples_per_channel_ * 100)); if (error != 0) { error_code_ = error; return kFail; } + RTC_DCHECK_EQ( + audio_frame->sample_rate_hz_, + rtc::checked_cast(audio_frame->samples_per_channel_ * 100)); SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(), last_vad_activity_, audio_frame); last_vad_activity_ = audio_frame->vad_activity_;