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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2272963002: NetEq: Don't check sample rate and frame size upon error (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/include/neteq.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Always set kVadUnknown when receive VAD is inactive. 199 // Always set kVadUnknown when receive VAD is inactive.
200 audio_frame->vad_activity_ = AudioFrame::kVadUnknown; 200 audio_frame->vad_activity_ = AudioFrame::kVadUnknown;
201 } 201 }
202 } 202 }
203 } // namespace 203 } // namespace
204 204
205 int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) { 205 int NetEqImpl::GetAudio(AudioFrame* audio_frame, bool* muted) {
206 TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio"); 206 TRACE_EVENT0("webrtc", "NetEqImpl::GetAudio");
207 rtc::CritScope lock(&crit_sect_); 207 rtc::CritScope lock(&crit_sect_);
208 int error = GetAudioInternal(audio_frame, muted); 208 int error = GetAudioInternal(audio_frame, muted);
209 RTC_DCHECK_EQ(
210 audio_frame->sample_rate_hz_,
211 rtc::checked_cast<int>(audio_frame->samples_per_channel_ * 100));
212 if (error != 0) { 209 if (error != 0) {
213 error_code_ = error; 210 error_code_ = error;
214 return kFail; 211 return kFail;
215 } 212 }
213 RTC_DCHECK_EQ(
214 audio_frame->sample_rate_hz_,
215 rtc::checked_cast<int>(audio_frame->samples_per_channel_ * 100));
216 SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(), 216 SetAudioFrameActivityAndType(vad_->enabled(), LastOutputType(),
217 last_vad_activity_, audio_frame); 217 last_vad_activity_, audio_frame);
218 last_vad_activity_ = audio_frame->vad_activity_; 218 last_vad_activity_ = audio_frame->vad_activity_;
219 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_; 219 last_output_sample_rate_hz_ = audio_frame->sample_rate_hz_;
220 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 || 220 RTC_DCHECK(last_output_sample_rate_hz_ == 8000 ||
221 last_output_sample_rate_hz_ == 16000 || 221 last_output_sample_rate_hz_ == 16000 ||
222 last_output_sample_rate_hz_ == 32000 || 222 last_output_sample_rate_hz_ == 32000 ||
223 last_output_sample_rate_hz_ == 48000) 223 last_output_sample_rate_hz_ == 48000)
224 << "Unexpected sample rate " << last_output_sample_rate_hz_; 224 << "Unexpected sample rate " << last_output_sample_rate_hz_;
225 return kOK; 225 return kOK;
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 } 2139 }
2140 } 2140 }
2141 2141
2142 void NetEqImpl::CreateDecisionLogic() { 2142 void NetEqImpl::CreateDecisionLogic() {
2143 decision_logic_.reset(DecisionLogic::Create( 2143 decision_logic_.reset(DecisionLogic::Create(
2144 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2144 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2145 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2145 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2146 tick_timer_.get())); 2146 tick_timer_.get()));
2147 } 2147 }
2148 } // namespace webrtc 2148 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/include/neteq.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698