| 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 3270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3281 ") != " | 3281 ") != " |
| 3282 "fileSamples(%" PRIuS ")", | 3282 "fileSamples(%" PRIuS ")", |
| 3283 audioFrame.samples_per_channel_, fileSamples); | 3283 audioFrame.samples_per_channel_, fileSamples); |
| 3284 return -1; | 3284 return -1; |
| 3285 } | 3285 } |
| 3286 | 3286 |
| 3287 return 0; | 3287 return 0; |
| 3288 } | 3288 } |
| 3289 | 3289 |
| 3290 void Channel::UpdatePlayoutTimestamp(bool rtcp) { | 3290 void Channel::UpdatePlayoutTimestamp(bool rtcp) { |
| 3291 uint32_t playout_timestamp = 0; | 3291 rtc::Optional<uint32_t> playout_timestamp = audio_coding_->PlayoutTimestamp(); |
| 3292 | 3292 |
| 3293 if (audio_coding_->PlayoutTimestamp(&playout_timestamp) == -1) { | 3293 if (!playout_timestamp) { |
| 3294 // This can happen if this channel has not been received any RTP packet. In | 3294 // This can happen if this channel has not been received any RTP packet. In |
| 3295 // this case, NetEq is not capable of computing playout timestamp. | 3295 // this case, NetEq is not capable of computing playout timestamp. |
| 3296 return; | 3296 return; |
| 3297 } | 3297 } |
| 3298 | 3298 |
| 3299 uint16_t delay_ms = 0; | 3299 uint16_t delay_ms = 0; |
| 3300 if (_audioDeviceModulePtr->PlayoutDelay(&delay_ms) == -1) { | 3300 if (_audioDeviceModulePtr->PlayoutDelay(&delay_ms) == -1) { |
| 3301 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), | 3301 WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3302 "Channel::UpdatePlayoutTimestamp() failed to read playout" | 3302 "Channel::UpdatePlayoutTimestamp() failed to read playout" |
| 3303 " delay from the ADM"); | 3303 " delay from the ADM"); |
| 3304 _engineStatisticsPtr->SetLastError( | 3304 _engineStatisticsPtr->SetLastError( |
| 3305 VE_CANNOT_RETRIEVE_VALUE, kTraceError, | 3305 VE_CANNOT_RETRIEVE_VALUE, kTraceError, |
| 3306 "UpdatePlayoutTimestamp() failed to retrieve playout delay"); | 3306 "UpdatePlayoutTimestamp() failed to retrieve playout delay"); |
| 3307 return; | 3307 return; |
| 3308 } | 3308 } |
| 3309 | 3309 |
| 3310 jitter_buffer_playout_timestamp_ = playout_timestamp; | 3310 jitter_buffer_playout_timestamp_ = *playout_timestamp; |
| 3311 | 3311 |
| 3312 // Remove the playout delay. | 3312 // Remove the playout delay. |
| 3313 playout_timestamp -= (delay_ms * (GetPlayoutFrequency() / 1000)); | 3313 *playout_timestamp -= (delay_ms * (GetPlayoutFrequency() / 1000)); |
| 3314 | 3314 |
| 3315 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), | 3315 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3316 "Channel::UpdatePlayoutTimestamp() => playoutTimestamp = %lu", | 3316 "Channel::UpdatePlayoutTimestamp() => playoutTimestamp = %lu", |
| 3317 playout_timestamp); | 3317 *playout_timestamp); |
| 3318 | 3318 |
| 3319 { | 3319 { |
| 3320 rtc::CritScope lock(&video_sync_lock_); | 3320 rtc::CritScope lock(&video_sync_lock_); |
| 3321 if (rtcp) { | 3321 if (rtcp) { |
| 3322 playout_timestamp_rtcp_ = playout_timestamp; | 3322 playout_timestamp_rtcp_ = *playout_timestamp; |
| 3323 } else { | 3323 } else { |
| 3324 playout_timestamp_rtp_ = playout_timestamp; | 3324 playout_timestamp_rtp_ = *playout_timestamp; |
| 3325 } | 3325 } |
| 3326 playout_delay_ms_ = delay_ms; | 3326 playout_delay_ms_ = delay_ms; |
| 3327 } | 3327 } |
| 3328 } | 3328 } |
| 3329 | 3329 |
| 3330 // Called for incoming RTP packets after successful RTP header parsing. | 3330 // Called for incoming RTP packets after successful RTP header parsing. |
| 3331 void Channel::UpdatePacketDelay(uint32_t rtp_timestamp, | 3331 void Channel::UpdatePacketDelay(uint32_t rtp_timestamp, |
| 3332 uint16_t sequence_number) { | 3332 uint16_t sequence_number) { |
| 3333 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), | 3333 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, _channelId), |
| 3334 "Channel::UpdatePacketDelay(timestamp=%lu, sequenceNumber=%u)", | 3334 "Channel::UpdatePacketDelay(timestamp=%lu, sequenceNumber=%u)", |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3528 int64_t min_rtt = 0; | 3528 int64_t min_rtt = 0; |
| 3529 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3529 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
| 3530 0) { | 3530 0) { |
| 3531 return 0; | 3531 return 0; |
| 3532 } | 3532 } |
| 3533 return rtt; | 3533 return rtt; |
| 3534 } | 3534 } |
| 3535 | 3535 |
| 3536 } // namespace voe | 3536 } // namespace voe |
| 3537 } // namespace webrtc | 3537 } // namespace webrtc |
| OLD | NEW |