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

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

Issue 1319683002: AudioDecoder: Replace Init() with Reset() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@buffer
Patch Set: review fixes Created 5 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
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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 SetSampleRateAndChannels(decoder_info->fs_hz, decoder->Channels()); 1171 SetSampleRateAndChannels(decoder_info->fs_hz, decoder->Channels());
1172 } 1172 }
1173 sync_buffer_->set_end_timestamp(timestamp_); 1173 sync_buffer_->set_end_timestamp(timestamp_);
1174 playout_timestamp_ = timestamp_; 1174 playout_timestamp_ = timestamp_;
1175 } 1175 }
1176 } 1176 }
1177 } 1177 }
1178 1178
1179 if (reset_decoder_) { 1179 if (reset_decoder_) {
1180 // TODO(hlundin): Write test for this. 1180 // TODO(hlundin): Write test for this.
1181 // Reset decoder. 1181 if (decoder)
1182 if (decoder) { 1182 decoder->Reset();
1183 decoder->Init(); 1183
1184 }
1185 // Reset comfort noise decoder. 1184 // Reset comfort noise decoder.
1186 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); 1185 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
1187 if (cng_decoder) { 1186 if (cng_decoder)
1188 cng_decoder->Init(); 1187 cng_decoder->Reset();
1189 } 1188
1190 reset_decoder_ = false; 1189 reset_decoder_ = false;
1191 } 1190 }
1192 1191
1193 #ifdef LEGACY_BITEXACT 1192 #ifdef LEGACY_BITEXACT
1194 // Due to a bug in old SignalMCU, it could happen that CNG operation was 1193 // Due to a bug in old SignalMCU, it could happen that CNG operation was
1195 // decided, but a speech packet was provided. The speech packet will be used 1194 // decided, but a speech packet was provided. The speech packet will be used
1196 // to update the comfort noise decoder, as if it was a SID frame, which is 1195 // to update the comfort noise decoder, as if it was a SID frame, which is
1197 // clearly wrong. 1196 // clearly wrong.
1198 if (*operation == kRfc3389Cng) { 1197 if (*operation == kRfc3389Cng) {
1199 return 0; 1198 return 0;
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 decoder_frame_length_ = 3 * output_size_samples_; // Initialize to 30ms. 1888 decoder_frame_length_ = 3 * output_size_samples_; // Initialize to 30ms.
1890 1889
1891 last_mode_ = kModeNormal; 1890 last_mode_ = kModeNormal;
1892 1891
1893 // Create a new array of mute factors and set all to 1. 1892 // Create a new array of mute factors and set all to 1.
1894 mute_factor_array_.reset(new int16_t[channels]); 1893 mute_factor_array_.reset(new int16_t[channels]);
1895 for (size_t i = 0; i < channels; ++i) { 1894 for (size_t i = 0; i < channels; ++i) {
1896 mute_factor_array_[i] = 16384; // 1.0 in Q14. 1895 mute_factor_array_[i] = 16384; // 1.0 in Q14.
1897 } 1896 }
1898 1897
1899 // Reset comfort noise decoder, if there is one active.
1900 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder(); 1898 AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
1901 if (cng_decoder) { 1899 if (cng_decoder)
1902 cng_decoder->Init(); 1900 cng_decoder->Reset();
1903 }
1904 1901
1905 // Reinit post-decode VAD with new sample rate. 1902 // Reinit post-decode VAD with new sample rate.
1906 assert(vad_.get()); // Cannot be NULL here. 1903 assert(vad_.get()); // Cannot be NULL here.
1907 vad_->Init(); 1904 vad_->Init();
1908 1905
1909 // Delete algorithm buffer and create a new one. 1906 // Delete algorithm buffer and create a new one.
1910 algorithm_buffer_.reset(new AudioMultiVector(channels)); 1907 algorithm_buffer_.reset(new AudioMultiVector(channels));
1911 1908
1912 // Delete sync buffer and create a new one. 1909 // Delete sync buffer and create a new one.
1913 sync_buffer_.reset(new SyncBuffer(channels, kSyncBufferSize * fs_mult_)); 1910 sync_buffer_.reset(new SyncBuffer(channels, kSyncBufferSize * fs_mult_));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 1967
1971 void NetEqImpl::CreateDecisionLogic() { 1968 void NetEqImpl::CreateDecisionLogic() {
1972 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, 1969 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_,
1973 playout_mode_, 1970 playout_mode_,
1974 decoder_database_.get(), 1971 decoder_database_.get(),
1975 *packet_buffer_.get(), 1972 *packet_buffer_.get(),
1976 delay_manager_.get(), 1973 delay_manager_.get(),
1977 buffer_level_filter_.get())); 1974 buffer_level_filter_.get()));
1978 } 1975 }
1979 } // namespace webrtc 1976 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698