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

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

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Third round of 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
11 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" 11 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <memory.h> // memset
15 14
16 #include <algorithm> 15 #include <algorithm>
17 #include <utility> 16 #include <utility>
18 #include <vector> 17 #include <vector>
19 18
20 #include "webrtc/api/audio_codecs/audio_decoder.h" 19 #include "webrtc/api/audio_codecs/audio_decoder.h"
21 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
22 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
23 #include "webrtc/base/safe_conversions.h" 22 #include "webrtc/base/safe_conversions.h"
24 #include "webrtc/base/sanitizer.h" 23 #include "webrtc/base/sanitizer.h"
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 RTC_DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples); 1008 RTC_DCHECK_GE(sync_buffer_->next_index(), missing_lookahead_samples);
1010 sync_buffer_->set_next_index(sync_buffer_->next_index() - 1009 sync_buffer_->set_next_index(sync_buffer_->next_index() -
1011 missing_lookahead_samples); 1010 missing_lookahead_samples);
1012 } 1011 }
1013 if (audio_frame->samples_per_channel_ != output_size_samples_) { 1012 if (audio_frame->samples_per_channel_ != output_size_samples_) {
1014 LOG(LS_ERROR) << "audio_frame->samples_per_channel_ (" 1013 LOG(LS_ERROR) << "audio_frame->samples_per_channel_ ("
1015 << audio_frame->samples_per_channel_ 1014 << audio_frame->samples_per_channel_
1016 << ") != output_size_samples_ (" << output_size_samples_ 1015 << ") != output_size_samples_ (" << output_size_samples_
1017 << ")"; 1016 << ")";
1018 // TODO(minyue): treatment of under-run, filling zeros 1017 // TODO(minyue): treatment of under-run, filling zeros
1019 memset(audio_frame->data_, 0, num_output_samples * sizeof(int16_t)); 1018 audio_frame->Mute();
1020 return kSampleUnderrun; 1019 return kSampleUnderrun;
1021 } 1020 }
1022 1021
1023 // Should always have overlap samples left in the |sync_buffer_|. 1022 // Should always have overlap samples left in the |sync_buffer_|.
1024 RTC_DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length()); 1023 RTC_DCHECK_GE(sync_buffer_->FutureLength(), expand_->overlap_length());
1025 1024
1025 // TODO(yujo): For muted frames, this can be a copy rather than an addition.
1026 if (play_dtmf) { 1026 if (play_dtmf) {
1027 return_value = 1027 return_value = DtmfOverdub(dtmf_event, sync_buffer_->Channels(),
1028 DtmfOverdub(dtmf_event, sync_buffer_->Channels(), audio_frame->data_); 1028 audio_frame->mutable_data());
1029 } 1029 }
1030 1030
1031 // Update the background noise parameters if last operation wrote data 1031 // Update the background noise parameters if last operation wrote data
1032 // straight from the decoder to the |sync_buffer_|. That is, none of the 1032 // 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. 1033 // operations that modify the signal can be followed by a parameter update.
1034 if ((last_mode_ == kModeNormal) || 1034 if ((last_mode_ == kModeNormal) ||
1035 (last_mode_ == kModeAccelerateFail) || 1035 (last_mode_ == kModeAccelerateFail) ||
1036 (last_mode_ == kModePreemptiveExpandFail) || 1036 (last_mode_ == kModePreemptiveExpandFail) ||
1037 (last_mode_ == kModeRfc3389Cng) || 1037 (last_mode_ == kModeRfc3389Cng) ||
1038 (last_mode_ == kModeCodecInternalCng)) { 1038 (last_mode_ == kModeCodecInternalCng)) {
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2128 }
2129 } 2129 }
2130 2130
2131 void NetEqImpl::CreateDecisionLogic() { 2131 void NetEqImpl::CreateDecisionLogic() {
2132 decision_logic_.reset(DecisionLogic::Create( 2132 decision_logic_.reset(DecisionLogic::Create(
2133 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), 2133 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(),
2134 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), 2134 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(),
2135 tick_timer_.get())); 2135 tick_timer_.get()));
2136 } 2136 }
2137 } // namespace webrtc 2137 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698