Quellcode-Bibliothek receive_time_calculator.cc
Sprache: C
/* * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
// Repair backwards clock resets during initial stall. In this case, the // reset is observed only in packet time but never in system time. if (system_time_delta_us < 0)
total_system_time_passed_us_ += config_.stall_threshold->us(); else
total_system_time_passed_us_ += system_time_delta_us; if (packet_time_delta_us < 0 &&
total_system_time_passed_us_ < config_.stall_threshold->us()) {
static_clock_offset_us_ -= packet_time_delta_us;
}
corrected_time_us += static_clock_offset_us_;
// Harder case with backward clock reset during stall, the reset being // smaller than the stall. Compensate throughout the stall. bool small_backward_clock_reset =
!obvious_backward_clock_reset &&
safe_time_delta_us > system_time_delta_us + config_.tolerance->us(); bool stall_start =
packet_time_delta_us >= 0 &&
system_time_delta_us > packet_time_delta_us + config_.tolerance->us(); bool stall_is_over = safe_time_delta_us > config_.stall_threshold->us(); bool packet_time_caught_up =
packet_time_delta_us < 0 && system_time_delta_us >= 0; if (stall_start && small_backward_clock_reset)
small_reset_during_stall_ = true; elseif (stall_is_over || packet_time_caught_up)
small_reset_during_stall_ = false;
// If resets are detected, advance time by (capped) packet time increase. if (forward_clock_reset || obvious_backward_clock_reset ||
small_reset_during_stall_) {
corrected_time_us = last_corrected_time_us_ +
rtc::SafeClamp(packet_time_delta_us, 0,
config_.max_packet_time_repair->us());
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.