| OLD | NEW |
| 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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 int payload_type = rtp_header->payloadType; | 754 int payload_type = rtp_header->payloadType; |
| 755 size_t channels = 1; | 755 size_t channels = 1; |
| 756 if (!decoder_database_->IsComfortNoise(payload_type)) { | 756 if (!decoder_database_->IsComfortNoise(payload_type)) { |
| 757 AudioDecoder* decoder = decoder_database_->GetDecoder(payload_type); | 757 AudioDecoder* decoder = decoder_database_->GetDecoder(payload_type); |
| 758 assert(decoder); // Payloads are already checked to be valid. | 758 assert(decoder); // Payloads are already checked to be valid. |
| 759 channels = decoder->Channels(); | 759 channels = decoder->Channels(); |
| 760 } | 760 } |
| 761 const DecoderDatabase::DecoderInfo* decoder_info = | 761 const DecoderDatabase::DecoderInfo* decoder_info = |
| 762 decoder_database_->GetDecoderInfo(payload_type); | 762 decoder_database_->GetDecoderInfo(payload_type); |
| 763 assert(decoder_info); | 763 assert(decoder_info); |
| 764 if (decoder_info->fs_hz != fs_hz_ || | 764 if (decoder_info->SampleRateHz() != fs_hz_ || |
| 765 channels != algorithm_buffer_->Channels()) { | 765 channels != algorithm_buffer_->Channels()) { |
| 766 SetSampleRateAndChannels(decoder_info->fs_hz, channels); | 766 SetSampleRateAndChannels(decoder_info->SampleRateHz(), |
| 767 channels); |
| 767 } | 768 } |
| 768 if (nack_enabled_) { | 769 if (nack_enabled_) { |
| 769 RTC_DCHECK(nack_); | 770 RTC_DCHECK(nack_); |
| 770 // Update the sample rate even if the rate is not new, because of Reset(). | 771 // Update the sample rate even if the rate is not new, because of Reset(). |
| 771 nack_->UpdateSampleRate(fs_hz_); | 772 nack_->UpdateSampleRate(fs_hz_); |
| 772 } | 773 } |
| 773 } | 774 } |
| 774 | 775 |
| 775 // TODO(hlundin): Move this code to DelayManager class. | 776 // TODO(hlundin): Move this code to DelayManager class. |
| 776 const DecoderDatabase::DecoderInfo* dec_info = | 777 const DecoderDatabase::DecoderInfo* dec_info = |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 ->GetDecoderInfo(payload_type); | 1341 ->GetDecoderInfo(payload_type); |
| 1341 assert(decoder_info); | 1342 assert(decoder_info); |
| 1342 if (!decoder_info) { | 1343 if (!decoder_info) { |
| 1343 LOG(LS_WARNING) << "Unknown payload type " | 1344 LOG(LS_WARNING) << "Unknown payload type " |
| 1344 << static_cast<int>(payload_type); | 1345 << static_cast<int>(payload_type); |
| 1345 PacketBuffer::DeleteAllPackets(packet_list); | 1346 PacketBuffer::DeleteAllPackets(packet_list); |
| 1346 return kDecoderNotFound; | 1347 return kDecoderNotFound; |
| 1347 } | 1348 } |
| 1348 // If sampling rate or number of channels has changed, we need to make | 1349 // If sampling rate or number of channels has changed, we need to make |
| 1349 // a reset. | 1350 // a reset. |
| 1350 if (decoder_info->fs_hz != fs_hz_ || | 1351 if (decoder_info->SampleRateHz() != fs_hz_ || |
| 1351 decoder->Channels() != algorithm_buffer_->Channels()) { | 1352 decoder->Channels() != algorithm_buffer_->Channels()) { |
| 1352 // TODO(tlegrand): Add unittest to cover this event. | 1353 // TODO(tlegrand): Add unittest to cover this event. |
| 1353 SetSampleRateAndChannels(decoder_info->fs_hz, decoder->Channels()); | 1354 SetSampleRateAndChannels(decoder_info->SampleRateHz(), |
| 1355 decoder->Channels()); |
| 1354 } | 1356 } |
| 1355 sync_buffer_->set_end_timestamp(timestamp_); | 1357 sync_buffer_->set_end_timestamp(timestamp_); |
| 1356 playout_timestamp_ = timestamp_; | 1358 playout_timestamp_ = timestamp_; |
| 1357 } | 1359 } |
| 1358 } | 1360 } |
| 1359 } | 1361 } |
| 1360 | 1362 |
| 1361 if (reset_decoder_) { | 1363 if (reset_decoder_) { |
| 1362 // TODO(hlundin): Write test for this. | 1364 // TODO(hlundin): Write test for this. |
| 1363 if (decoder) | 1365 if (decoder) |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2165 } | 2167 } |
| 2166 } | 2168 } |
| 2167 | 2169 |
| 2168 void NetEqImpl::CreateDecisionLogic() { | 2170 void NetEqImpl::CreateDecisionLogic() { |
| 2169 decision_logic_.reset(DecisionLogic::Create( | 2171 decision_logic_.reset(DecisionLogic::Create( |
| 2170 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2172 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
| 2171 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2173 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
| 2172 tick_timer_.get())); | 2174 tick_timer_.get())); |
| 2173 } | 2175 } |
| 2174 } // namespace webrtc | 2176 } // namespace webrtc |
| OLD | NEW |