|
@@ -236,7 +236,9 @@ double SynchronizerV2::getClock(ClockType type) const {
|
|
|
|
|
|
|
|
double time = getCurrentTime();
|
|
double time = getCurrentTime();
|
|
|
// 计算当前时钟时间 = pts + (当前时间 - 上次更新时间) * 速度
|
|
// 计算当前时钟时间 = pts + (当前时间 - 上次更新时间) * 速度
|
|
|
- return clock->ptsDrift + (time - clock->lastUpdated) * clock->speed;
|
|
|
|
|
|
|
+ // return clock->ptsDrift + (time - clock->lastUpdated) * clock->speed;
|
|
|
|
|
+
|
|
|
|
|
+ return clock->ptsDrift + time + (time - clock->lastUpdated) * (1.0 - clock->speed);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 设置时钟
|
|
// 设置时钟
|
|
@@ -573,7 +575,7 @@ void SynchronizerV2::setFrameDropCallback(const FrameDropCallback& callback) {
|
|
|
// 获取调试信息
|
|
// 获取调试信息
|
|
|
std::string SynchronizerV2::getDebugInfo() const {
|
|
std::string SynchronizerV2::getDebugInfo() const {
|
|
|
std::stringstream ss;
|
|
std::stringstream ss;
|
|
|
-
|
|
|
|
|
|
|
+ ss.precision(4);
|
|
|
// 获取当前状态
|
|
// 获取当前状态
|
|
|
bool initialized = m_initialized;
|
|
bool initialized = m_initialized;
|
|
|
bool running = m_running;
|
|
bool running = m_running;
|
|
@@ -696,8 +698,8 @@ void SynchronizerV2::checkExternalClockSpeed() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取当前时间(秒)
|
|
// 获取当前时间(秒)
|
|
|
-double SynchronizerV2::getCurrentTime() const {
|
|
|
|
|
- // 使用av_gettime_relative获取相对时间(微秒),转换为秒
|
|
|
|
|
|
|
+double SynchronizerV2::getCurrentTime() const
|
|
|
|
|
+{
|
|
|
return av_gettime_relative() / 1000000.0;
|
|
return av_gettime_relative() / 1000000.0;
|
|
|
}
|
|
}
|
|
|
|
|
|