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

WIP: revert DepLibUV int64 helpers

上级 dbb45993
......@@ -25,6 +25,10 @@
#include <cmath>
#include <utility>
// TODO: Issue 357 stuff.
static uint8_t Issue357LastFeedbackBuffer[65536];
static size_t Issue357LastFeedbackSize{ 0u };
namespace webrtc {
namespace {
......@@ -184,7 +188,7 @@ std::vector<PacketFeedback> TransportFeedbackAdapter::GetPacketFeedbackVector(
mediasoup_helpers::FeedbackRtpTransport::GetBaseDeltaUs(&feedback, last_timestamp_us_) / 1000;
}
// NOTE: Debug for https://github.com/versatica/mediasoup/issues/357.
// TODO (issue 357).
int64_t prev_last_timestamp_us = last_timestamp_us_;
last_timestamp_us_ =
......@@ -222,7 +226,7 @@ std::vector<PacketFeedback> TransportFeedbackAdapter::GetPacketFeedbackVector(
// NOTE: Debug for https://github.com/versatica/mediasoup/issues/357.
if (timestamp_ms < 0) {
MS_ERROR("timestamps_ms < 0 [timestamp_ms:%" PRIi64
MS_ERROR("[ISSUE 357] timestamps_ms < 0 [timestamp_ms:%" PRIi64
", current_offset_ms_:%" PRIi64
", offset_us:%" PRIi64
", last_timestamp_us_:%" PRIi64
......@@ -235,6 +239,24 @@ std::vector<PacketFeedback> TransportFeedbackAdapter::GetPacketFeedbackVector(
prev_last_timestamp_us,
feedback.GetReferenceTimestamp()
);
if (Issue357LastFeedbackSize > 0)
{
auto* previousFeedback = RTC::RTCP::FeedbackRtpTransportPacket::Parse(Issue357LastFeedbackBuffer, Issue357LastFeedbackSize);
MS_ERROR("[ISSUE 357] previousFeedback.dump():");
previousFeedback->Dump();
MS_ERROR("[ISSUE 357] MS_DUMP_DATA(previousFeedback):");
MS_DUMP_DATA(previousFeedback->GetData(), previousFeedback->GetSize());
delete previousFeedback;
}
// TODO: TMP for issue 357.
MS_ERROR("[ISSUE 357] feedback.dump():");
feedback.Dump();
MS_ERROR("[ISSUE 357] MS_DUMP_DATA(feedback):");
MS_DUMP_DATA(feedback.GetData(), feedback.GetSize());
}
PacketFeedback packet_feedback(timestamp_ms, packet.sequence_number());
......@@ -254,6 +276,11 @@ std::vector<PacketFeedback> TransportFeedbackAdapter::GetPacketFeedbackVector(
(failed_lookups > 1 ? "s" : ""));
}
}
// TODO (issue 357): Store this feedback.
std::memcpy(Issue357LastFeedbackBuffer, feedback.GetData(), feedback.GetSize());
Issue357LastFeedbackSize = feedback.GetSize();
return packet_feedback_vector;
}
......
......@@ -3,7 +3,6 @@
#include "common.hpp"
#include <uv.h>
#include <limits>
class DepLibUV
{
......@@ -28,40 +27,17 @@ public:
{
return uv_hrtime();
}
// Used within libwebrtc dependency which uses int64_t possitive values for
// time representation.
// Used within libwebrtc dependency which uses int64_t values for time
// representation.
static int64_t GetTimeMsInt64()
{
static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
uint64_t time = DepLibUV::GetTimeMs();
if (time > MaxInt64)
time -= MaxInt64 - 1;
return static_cast<int64_t>(time);
return static_cast<int64_t>(DepLibUV::GetTimeMs());
}
// Used within libwebrtc dependency which uses int64_t possitive values for
// time representation.
// Used within libwebrtc dependency which uses int64_t values for time
// representation.
static int64_t GetTimeUsInt64()
{
static constexpr uint64_t MaxInt64{ std::numeric_limits<int64_t>::max() };
uint64_t time = DepLibUV::GetTimeUs();
if (time > MaxInt64)
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>(DepLibUV::GetTimeUs());
}
private:
......
......@@ -116,7 +116,7 @@ namespace RTC
this->baseSequenceNumber = Utils::Byte::Get2Bytes(data, 0);
this->packetStatusCount = Utils::Byte::Get2Bytes(data, 2);
this->referenceTime = parseReferenceTime(data + 4u);
this->referenceTime = parseReferenceTime(data + 4);
this->feedbackPacketCount = Utils::Byte::Get1Byte(data, 7);
this->size = len;
......
......@@ -181,8 +181,9 @@ namespace RTC
break;
// 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);
// we give it to libwebrtc lib (althought this is implicit in the
// conversion so it would be converted within the method call).
auto nowMsInt64 = static_cast<int64_t>(nowMs);
this->rembServer->IncomingPacket(nowMsInt64, packet->GetPayloadLength(), *packet, absSendTime);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论