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

Producer: clone RtpPacket so we can mangle its payload/size in Codecs::ProcessRtpPacket().

上级 99d947a2
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
namespace RTC namespace RTC
{ {
// Internal buffer for RTCP serialization. // Max RTP length.
constexpr size_t RtpBufferSize{ 65536 }; constexpr size_t RtpBufferSize{ 65536 };
extern uint8_t RtpBuffer[RtpBufferSize];
// Max MTU size. // Max MTU size.
constexpr size_t MtuSize{ 1500 }; constexpr size_t MtuSize{ 1500 };
......
...@@ -13,6 +13,7 @@ namespace RTC ...@@ -13,6 +13,7 @@ namespace RTC
{ {
/* Static. */ /* Static. */
static uint8_t ClonedPacketBuffer[RTC::RtpBufferSize];
static constexpr uint64_t KeyFrameRequestBlockTimeout{ 1000 }; // In ms. static constexpr uint64_t KeyFrameRequestBlockTimeout{ 1000 }; // In ms.
/* Instance methods. */ /* Instance methods. */
...@@ -184,6 +185,7 @@ namespace RTC ...@@ -184,6 +185,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> clonedPacket;
if (this->rtpStreams.find(ssrc) != this->rtpStreams.end()) if (this->rtpStreams.find(ssrc) != this->rtpStreams.end())
{ {
...@@ -208,6 +210,11 @@ namespace RTC ...@@ -208,6 +210,11 @@ namespace RTC
return; return;
} }
// Let's clone the RTP packet so we can mangle the payload (if needed) and other
// stuff that would change its size.
packet = packet->Clone(ClonedPacketBuffer);
clonedPacket.reset(packet->Clone(ClonedPacketBuffer));
// Process the packet at codec level. // Process the packet at codec level.
if (packet->GetPayloadType() == rtpStream->GetPayloadType()) if (packet->GetPayloadType() == rtpStream->GetPayloadType())
Codecs::ProcessRtpPacket(packet, rtpStream->GetMimeType()); Codecs::ProcessRtpPacket(packet, rtpStream->GetMimeType());
......
...@@ -10,10 +10,6 @@ ...@@ -10,10 +10,6 @@
namespace RTC namespace RTC
{ {
/* Namespace variables. */
uint8_t RtpBuffer[RtpBufferSize];
/* Class methods. */ /* Class methods. */
RtpPacket* RtpPacket::Parse(const uint8_t* data, size_t len) RtpPacket* RtpPacket::Parse(const uint8_t* data, size_t len)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论