Chromium Code Reviews| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 assert(vad_.get()); | 394 assert(vad_.get()); |
| 395 vad_->Enable(); | 395 vad_->Enable(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void NetEqImpl::DisableVad() { | 398 void NetEqImpl::DisableVad() { |
| 399 rtc::CritScope lock(&crit_sect_); | 399 rtc::CritScope lock(&crit_sect_); |
| 400 assert(vad_.get()); | 400 assert(vad_.get()); |
| 401 vad_->Disable(); | 401 vad_->Disable(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 rtc::Optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() { | 404 rtc::Optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() const { |
| 405 rtc::CritScope lock(&crit_sect_); | 405 rtc::CritScope lock(&crit_sect_); |
| 406 if (first_packet_) { | 406 if (first_packet_) { |
| 407 // We don't have a valid RTP timestamp until we have decoded our first | 407 // We don't have a valid RTP timestamp until we have decoded our first |
| 408 // RTP packet. | 408 // RTP packet. |
| 409 return rtc::Optional<uint32_t>(); | 409 return rtc::Optional<uint32_t>(); |
| 410 } | 410 } |
| 411 return rtc::Optional<uint32_t>( | 411 return rtc::Optional<uint32_t>( |
| 412 timestamp_scaler_->ToExternal(playout_timestamp_)); | 412 timestamp_scaler_->ToExternal(playout_timestamp_)); |
| 413 } | 413 } |
| 414 | 414 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 959 // would be moved "backwards". | 959 // would be moved "backwards". |
| 960 uint32_t temp_timestamp = sync_buffer_->end_timestamp() - | 960 uint32_t temp_timestamp = sync_buffer_->end_timestamp() - |
| 961 static_cast<uint32_t>(sync_buffer_->FutureLength()); | 961 static_cast<uint32_t>(sync_buffer_->FutureLength()); |
| 962 if (static_cast<int32_t>(temp_timestamp - playout_timestamp_) > 0) { | 962 if (static_cast<int32_t>(temp_timestamp - playout_timestamp_) > 0) { |
| 963 playout_timestamp_ = temp_timestamp; | 963 playout_timestamp_ = temp_timestamp; |
| 964 } | 964 } |
| 965 } else { | 965 } else { |
| 966 // Use dead reckoning to estimate the |playout_timestamp_|. | 966 // Use dead reckoning to estimate the |playout_timestamp_|. |
| 967 playout_timestamp_ += static_cast<uint32_t>(output_size_samples_); | 967 playout_timestamp_ += static_cast<uint32_t>(output_size_samples_); |
| 968 } | 968 } |
| 969 // Set the timestamp in the audio frame to zero before the first packet has | |
| 970 // been inserted. Otherwise, subtract the frame size in samples to get the | |
| 971 // timestamp of the first sample in the frame (playout_timestamp_ is the | |
| 972 // last + 1). | |
| 973 audio_frame->timestamp_ = | |
|
minyue-webrtc
2016/04/06 11:16:26
maybe too many lines here
hlundin-webrtc
2016/04/06 11:18:21
This is what git cl format gave me, and I'd rather
| |
| 974 first_packet_ | |
| 975 ? 0 | |
| 976 : timestamp_scaler_->ToExternal(playout_timestamp_) - | |
| 977 static_cast<uint32_t>(audio_frame->samples_per_channel_); | |
| 969 | 978 |
| 970 if (decode_return_value) return decode_return_value; | 979 if (decode_return_value) return decode_return_value; |
| 971 return return_value; | 980 return return_value; |
| 972 } | 981 } |
| 973 | 982 |
| 974 int NetEqImpl::GetDecision(Operations* operation, | 983 int NetEqImpl::GetDecision(Operations* operation, |
| 975 PacketList* packet_list, | 984 PacketList* packet_list, |
| 976 DtmfEvent* dtmf_event, | 985 DtmfEvent* dtmf_event, |
| 977 bool* play_dtmf) { | 986 bool* play_dtmf) { |
| 978 // Initialize output variables. | 987 // Initialize output variables. |
| (...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2084 | 2093 |
| 2085 void NetEqImpl::CreateDecisionLogic() { | 2094 void NetEqImpl::CreateDecisionLogic() { |
| 2086 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 2095 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
| 2087 playout_mode_, | 2096 playout_mode_, |
| 2088 decoder_database_.get(), | 2097 decoder_database_.get(), |
| 2089 *packet_buffer_.get(), | 2098 *packet_buffer_.get(), |
| 2090 delay_manager_.get(), | 2099 delay_manager_.get(), |
| 2091 buffer_level_filter_.get())); | 2100 buffer_level_filter_.get())); |
| 2092 } | 2101 } |
| 2093 } // namespace webrtc | 2102 } // namespace webrtc |
| OLD | NEW |