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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 424 } |
425 return rtc::Optional<uint32_t>( | 425 return rtc::Optional<uint32_t>( |
426 timestamp_scaler_->ToExternal(playout_timestamp_)); | 426 timestamp_scaler_->ToExternal(playout_timestamp_)); |
427 } | 427 } |
428 | 428 |
429 int NetEqImpl::last_output_sample_rate_hz() const { | 429 int NetEqImpl::last_output_sample_rate_hz() const { |
430 rtc::CritScope lock(&crit_sect_); | 430 rtc::CritScope lock(&crit_sect_); |
431 return last_output_sample_rate_hz_; | 431 return last_output_sample_rate_hz_; |
432 } | 432 } |
433 | 433 |
434 rtc::Optional<CodecInst> NetEqImpl::GetDecoder(int payload_type) const { | |
435 rtc::CritScope lock(&crit_sect_); | |
436 const DecoderDatabase::DecoderInfo* di = | |
437 decoder_database_->GetDecoderInfo(payload_type); | |
438 if (!di) { | |
439 return rtc::Optional<CodecInst>(); | |
440 } | |
441 | |
442 // Create a CodecInst with some fields set. The remaining fields are zeroed, | |
443 // but we tell MSan to consider them uninitialized. | |
444 CodecInst ci = {0}; | |
445 rtc::MsanMarkUninitialized(rtc::MakeArrayView(&ci, 1)); | |
446 ci.pltype = payload_type; | |
447 std::strncpy(ci.plname, di->name.c_str(), sizeof(ci.plname)); | |
448 ci.plname[sizeof(ci.plname) - 1] = '\0'; | |
449 ci.plfreq = di->IsRed() || di->IsDtmf() ? 8000 : di->SampleRateHz(); | |
450 AudioDecoder* const decoder = di->GetDecoder(); | |
451 ci.channels = decoder ? decoder->Channels() : 1; | |
452 return rtc::Optional<CodecInst>(ci); | |
453 } | |
454 | |
455 int NetEqImpl::SetTargetNumberOfChannels() { | 434 int NetEqImpl::SetTargetNumberOfChannels() { |
456 return kNotImplemented; | 435 return kNotImplemented; |
457 } | 436 } |
458 | 437 |
459 int NetEqImpl::SetTargetSampleRate() { | 438 int NetEqImpl::SetTargetSampleRate() { |
460 return kNotImplemented; | 439 return kNotImplemented; |
461 } | 440 } |
462 | 441 |
463 int NetEqImpl::LastError() const { | 442 int NetEqImpl::LastError() const { |
464 rtc::CritScope lock(&crit_sect_); | 443 rtc::CritScope lock(&crit_sect_); |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 } | 2075 } |
2097 } | 2076 } |
2098 | 2077 |
2099 void NetEqImpl::CreateDecisionLogic() { | 2078 void NetEqImpl::CreateDecisionLogic() { |
2100 decision_logic_.reset(DecisionLogic::Create( | 2079 decision_logic_.reset(DecisionLogic::Create( |
2101 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), | 2080 fs_hz_, output_size_samples_, playout_mode_, decoder_database_.get(), |
2102 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), | 2081 *packet_buffer_.get(), delay_manager_.get(), buffer_level_filter_.get(), |
2103 tick_timer_.get())); | 2082 tick_timer_.get())); |
2104 } | 2083 } |
2105 } // namespace webrtc | 2084 } // namespace webrtc |
OLD | NEW |