提交 d8b4a929 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Ensure RemoteBitrateEstimatorAbsSendTime::IncomingPacket() receives int64_t

上级 8ab389b4
...@@ -37,9 +37,7 @@ public: ...@@ -37,9 +37,7 @@ public:
uint64_t time = DepLibUV::GetTimeMs(); uint64_t time = DepLibUV::GetTimeMs();
if (time > MaxInt64) if (time > MaxInt64)
{
time -= MaxInt64 - 1; time -= MaxInt64 - 1;
}
return static_cast<int64_t>(time); return static_cast<int64_t>(time);
} }
...@@ -52,9 +50,16 @@ public: ...@@ -52,9 +50,16 @@ public:
uint64_t time = DepLibUV::GetTimeUs(); uint64_t time = DepLibUV::GetTimeUs();
if (time > MaxInt64) if (time > MaxInt64)
{
time -= MaxInt64 - 1; time -= MaxInt64 - 1;
return static_cast<int64_t>(time);
} }
static int64_t TimeMs2TimeMsInt64(uint64_t time)
{
static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
if (time > MaxInt64)
time -= MaxInt64 - 1;
return static_cast<int64_t>(time); return static_cast<int64_t>(time);
} }
......
...@@ -180,7 +180,11 @@ namespace RTC ...@@ -180,7 +180,11 @@ namespace RTC
if (!packet->ReadAbsSendTime(absSendTime)) if (!packet->ReadAbsSendTime(absSendTime))
break; break;
this->rembServer->IncomingPacket(nowMs, packet->GetPayloadLength(), *packet, absSendTime); // NOTE: nowMs is uint64_t but we need to "convert" it to int64_t before
// we give it to libwebrtc lib.
auto nowMsInt64 = DepLibUV::TimeMs2TimeMsInt64(nowMs);
this->rembServer->IncomingPacket(nowMsInt64, packet->GetPayloadLength(), *packet, absSendTime);
break; break;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论