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

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

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Address review comments Created 3 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 unified diff | Download patch
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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 RTC_DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples); 1009 RTC_DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples);
1010 sync_buffer_->set_next_index(sync_buffer_->next_index() - 1010 sync_buffer_->set_next_index(sync_buffer_->next_index() -
1011 missing_lookahead_samples); 1011 missing_lookahead_samples);
1012 } 1012 }
1013 if (audio_frame->samples_per_channel_ != output_size_samples_) { 1013 if (audio_frame->samples_per_channel_ != output_size_samples_) {
1014 LOG(LS_ERROR) << "audio_frame->samples_per_channel_ (" 1014 LOG(LS_ERROR) << "audio_frame->samples_per_channel_ ("
1015 << audio_frame->samples_per_channel_ 1015 << audio_frame->samples_per_channel_
1016 << ") != output_size_samples_ (" << output_size_samples_ 1016 << ") != output_size_samples_ (" << output_size_samples_
1017 << ")"; 1017 << ")";
1018 // TODO(minyue): treatment of under-run, filling zeros 1018 // TODO(minyue): treatment of under-run, filling zeros
1019 memset(audio_frame->data_, 0, num_output_samples * sizeof(int16_t)); 1019 audio_frame->Mute();
1020 return kSampleUnderrun; 1020 return kSampleUnderrun;
1021 } 1021 }
1022 1022
1023 // Should always have overlap samples left in the |sync_buffer_|. 1023 // Should always have overlap samples left in the |sync_buffer_|.
1024 RTC_DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length()); 1024 RTC_DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length());
1025 1025
1026 // TODO(yujo): For muted frames, this can be a copy rather than an addition.
1026 if (play_dtmf) { 1027 if (play_dtmf) {
1027 return_value = 1028 return_value = DtmfOverdub(dtmf_event, sync_buffer_->Channels(),
1028 DtmfOverdub(dtmf_event, sync_buffer_->Channels(), audio_frame->data_); 1029 audio_frame->mutable_data());
1029 } 1030 }
1030 1031
1031 // Update the background noise parameters if last operation wrote data 1032 // Update the background noise parameters if last operation wrote data
1032 // straight from the decoder to the |sync_buffer_|. That is, none of the 1033 // straight from the decoder to the |sync_buffer_|. That is, none of the
1033 // operations that modify the signal can be followed by a parameter update. 1034 // operations that modify the signal can be followed by a parameter update.
1034 if ((last_mode_ == kModeNormal) || 1035 if ((last_mode_ == kModeNormal) ||
1035 (last_mode_ == kModeAccelerateFail) || 1036 (last_mode_ == kModeAccelerateFail) ||
1036 (last_mode_ == kModePreemptiveExpandFail) || 1037 (last_mode_ == kModePreemptiveExpandFail) ||
1037 (last_mode_ == kModeRfc3389Cng) || 1038 (last_mode_ == kModeRfc3389Cng) ||
1038 (last_mode_ == kModeCodecInternalCng)) { 1039 (last_mode_ == kModeCodecInternalCng)) {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2129 }
2129 } 2130 }
2130 2131
2131 void NetEqImpl::CreateDecisionLogic() { 2132 void NetEqImpl::CreateDecisionLogic() {
2132 decision_logic_.reset(DecisionLogic::Create( 2133 decision_logic_.reset(DecisionLogic::Create(
2133 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2134 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2134 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2135 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2135 tick_timer_.get())); 2136 tick_timer_.get()));
2136 } 2137 }
2137 } // namespace webrtc 2138 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698