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

Fix serialization of RTX decoded packets.

上级 a71272bc
...@@ -9,10 +9,10 @@ namespace RTC ...@@ -9,10 +9,10 @@ namespace RTC
{ {
/* Static. */ /* Static. */
constexpr uint32_t MaxPacketAge{ 10000 }; constexpr uint32_t MaxPacketAge{ 5000 };
constexpr size_t MaxNackPackets{ 1000 }; constexpr size_t MaxNackPackets{ 1000 };
constexpr uint32_t DefaultRtt{ 100 }; constexpr uint32_t DefaultRtt{ 100 };
constexpr uint8_t MaxNackRetries{ 10 }; constexpr uint8_t MaxNackRetries{ 8 };
constexpr uint64_t TimerInterval{ 50 }; constexpr uint64_t TimerInterval{ 50 };
/* Instance methods. */ /* Instance methods. */
......
...@@ -14,6 +14,8 @@ namespace RTC ...@@ -14,6 +14,8 @@ namespace RTC
/* Static. */ /* Static. */
static constexpr uint64_t KeyFrameRequestBlockTimeout{ 1000 }; // In ms. static constexpr uint64_t KeyFrameRequestBlockTimeout{ 1000 }; // In ms.
static constexpr size_t ClonedPacketBufferSize{ 65536 };
static uint8_t ClonedPacketBuffer[ClonedPacketBufferSize];
/* Instance methods. */ /* Instance methods. */
...@@ -267,6 +269,7 @@ namespace RTC ...@@ -267,6 +269,7 @@ namespace RTC
// Find the corresponding RtpStreamRecv. // Find the corresponding RtpStreamRecv.
uint32_t ssrc = packet->GetSsrc(); uint32_t ssrc = packet->GetSsrc();
RTC::RtpStreamRecv* rtpStream{ nullptr }; RTC::RtpStreamRecv* rtpStream{ nullptr };
std::unique_ptr<RTC::RtpPacket> rtxDecodedPacket;
if (this->rtpStreams.find(ssrc) != this->rtpStreams.end()) if (this->rtpStreams.find(ssrc) != this->rtpStreams.end())
{ {
...@@ -291,6 +294,14 @@ namespace RTC ...@@ -291,6 +294,14 @@ namespace RTC
// Process the packet. // Process the packet.
if (!rtpStream->ReceiveRtxPacket(packet)) if (!rtpStream->ReceiveRtxPacket(packet))
return; return;
// We need to clone the RTX decoded packet so it becomes later serializable
// by just taking its GetData() and GetSize(), so clone it and reassign the
// new RtpPacket to the packet pointer (so the rest of the code below doesn't
// need any change) and assign it to the unique_ptr to be automatically
// freed once this method returns.
packet = packet->Clone(ClonedPacketBuffer);
rtxDecodedPacket.reset(packet);
} }
else else
{ {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论