Move timestamp_extrapolator.h to rtc_base/time/
This moves it from an API directory (system_wrappers/include/) to a non-API directory, which is exactly what we want for utilities like this. BUG=webrtc:8445 Change-Id: I51dfe8879c28c91bd1c667fc47b4892373671e0f Reviewed-on: https://webrtc-review.googlesource.com/21540 Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22569}
This commit is contained in:
@ -210,6 +210,7 @@ rtc_static_library("rtp_rtcp") {
|
||||
"../../rtc_base:sequenced_task_checker",
|
||||
"../../rtc_base:stringutils",
|
||||
"../../rtc_base/system:fallthrough",
|
||||
"../../rtc_base/time:timestamp_extrapolator",
|
||||
"../../system_wrappers",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:metrics_api",
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h"
|
||||
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/time/timestamp_extrapolator.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -153,6 +153,7 @@ rtc_static_library("video_coding") {
|
||||
"../../rtc_base:sequenced_task_checker",
|
||||
"../../rtc_base/experiments:alr_experiment",
|
||||
"../../rtc_base/system:fallthrough",
|
||||
"../../rtc_base/time:timestamp_extrapolator",
|
||||
"../../system_wrappers",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:metrics_api",
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "rtc_base/time/timestamp_extrapolator.h"
|
||||
#include "system_wrappers/include/clock.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/timestamp_extrapolator.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
24
rtc_base/time/BUILD.gn
Normal file
24
rtc_base/time/BUILD.gn
Normal file
@ -0,0 +1,24 @@
|
||||
# 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.
|
||||
|
||||
import("../../webrtc.gni")
|
||||
if (is_android) {
|
||||
import("//build/config/android/config.gni")
|
||||
import("//build/config/android/rules.gni")
|
||||
}
|
||||
|
||||
rtc_source_set("timestamp_extrapolator") {
|
||||
sources = [
|
||||
"timestamp_extrapolator.cc",
|
||||
"timestamp_extrapolator.h",
|
||||
]
|
||||
deps = [
|
||||
"../..:typedefs",
|
||||
"../../system_wrappers",
|
||||
]
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "system_wrappers/include/timestamp_extrapolator.h"
|
||||
#include "rtc_base/time/timestamp_extrapolator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -178,12 +178,14 @@ void TimestampExtrapolator::CheckForWrapArounds(uint32_t ts90khz) {
|
||||
// Forward wrap around
|
||||
_wrapArounds++;
|
||||
}
|
||||
}
|
||||
// This difference will probably be less than -2^31 if we have had a backward
|
||||
// wrap around. Since it is casted to a Word32, it should be positive.
|
||||
else if (static_cast<int32_t>(_prevWrapTimestamp - ts90khz) > 0) {
|
||||
// Backward wrap around
|
||||
_wrapArounds--;
|
||||
} else {
|
||||
// This difference will probably be less than -2^31 if we have had a
|
||||
// backward wrap around. Since it is casted to a Word32, it should be
|
||||
// positive.
|
||||
if (static_cast<int32_t>(_prevWrapTimestamp - ts90khz) > 0) {
|
||||
// Backward wrap around
|
||||
_wrapArounds--;
|
||||
}
|
||||
}
|
||||
_prevWrapTimestamp = ts90khz;
|
||||
}
|
||||
@ -193,9 +195,9 @@ bool TimestampExtrapolator::DelayChangeDetection(double error) {
|
||||
error = (error > 0) ? std::min(error, _accMaxError)
|
||||
: std::max(error, -_accMaxError);
|
||||
_detectorAccumulatorPos =
|
||||
std::max(_detectorAccumulatorPos + error - _accDrift, (double)0);
|
||||
std::max(_detectorAccumulatorPos + error - _accDrift, double{0});
|
||||
_detectorAccumulatorNeg =
|
||||
std::min(_detectorAccumulatorNeg + error + _accDrift, (double)0);
|
||||
std::min(_detectorAccumulatorNeg + error + _accDrift, double{0});
|
||||
if (_detectorAccumulatorPos > _alarmThreshold ||
|
||||
_detectorAccumulatorNeg < -_alarmThreshold) {
|
||||
// Alarm
|
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_
|
||||
#define SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_
|
||||
#ifndef RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
|
||||
#define RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
|
||||
|
||||
#include "system_wrappers/include/rw_lock_wrapper.h"
|
||||
#include "typedefs.h" // NOLINT(build/include)
|
||||
@ -51,4 +51,4 @@ class TimestampExtrapolator {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // SYSTEM_WRAPPERS_INCLUDE_TIMESTAMP_EXTRAPOLATOR_H_
|
||||
#endif // RTC_BASE_TIME_TIMESTAMP_EXTRAPOLATOR_H_
|
@ -23,7 +23,6 @@ rtc_static_library("system_wrappers") {
|
||||
"include/rtp_to_ntp_estimator.h",
|
||||
"include/rw_lock_wrapper.h",
|
||||
"include/sleep.h",
|
||||
"include/timestamp_extrapolator.h",
|
||||
"source/clock.cc",
|
||||
"source/cpu_features.cc",
|
||||
"source/cpu_info.cc",
|
||||
@ -40,7 +39,6 @@ rtc_static_library("system_wrappers") {
|
||||
"source/rw_lock_win.cc",
|
||||
"source/rw_lock_win.h",
|
||||
"source/sleep.cc",
|
||||
"source/timestamp_extrapolator.cc",
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
@ -94,6 +94,7 @@ rtc_static_library("video") {
|
||||
"../rtc_base:rtc_task_queue",
|
||||
"../rtc_base:sequenced_task_checker",
|
||||
"../rtc_base:weak_ptr",
|
||||
"../rtc_base/time:timestamp_extrapolator",
|
||||
"../system_wrappers",
|
||||
]
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "rtc_base/system/fallthrough.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
#include "system_wrappers/include/timestamp_extrapolator.h"
|
||||
#include "video/receive_statistics_proxy.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
Reference in New Issue
Block a user