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

WIP: revert DepLibUV int64 helpers

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