提交 d669653d authored 作者: José Luis Millán's avatar José Luis Millán

Consumer: synchronize RTP Timestamp once resumed

上级 3f917d4e
......@@ -35,8 +35,10 @@ namespace RTC
uint32_t GetRate(uint64_t now);
uint32_t GetSsrc() const;
uint8_t GetPayloadType() const;
uint32_t GetClockRate() const;
const RTC::RtpCodecMimeType& GetMimeType() const;
float GetLossPercentage() const;
uint64_t GetMaxPacketMs() const;
void RestartStatusCheckTimer();
void StopStatusCheckTimer();
......@@ -101,6 +103,11 @@ namespace RTC
return this->params.payloadType;
}
inline uint32_t RtpStream::GetClockRate() const
{
return this->params.clockRate;
}
inline const RTC::RtpCodecMimeType& RtpStream::GetMimeType() const
{
return this->params.mimeType;
......@@ -110,6 +117,11 @@ namespace RTC
{
return static_cast<float>(this->fractionLost) * 100 / 256;
}
inline uint64_t RtpStream::GetMaxPacketMs() const
{
return this->maxPacketMs;
}
} // namespace RTC
#endif
......@@ -494,7 +494,13 @@ namespace RTC
isSyncPacket = true;
this->rtpSeqManager.Sync(packet->GetSequenceNumber());
this->rtpTimestampManager.Sync(packet->GetTimestamp());
// Calculate RTP timestamp diff between now and last sent RTP packet.
auto now = DepLibUV::GetTime();
auto diffMs = now - this->rtpStream->GetMaxPacketMs();
auto diffTs = diffMs * this->rtpStream->GetClockRate() / 1000;
this->rtpTimestampManager.Sync(packet->GetTimestamp() + diffTs);
this->syncRequired = false;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论