提交 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 @@
namespace RTC
{
// Internal buffer for RTCP serialization.
// Max RTP length.
constexpr size_t RtpBufferSize{ 65536 };
extern uint8_t RtpBuffer[RtpBufferSize];
// Max MTU size.
constexpr size_t MtuSize{ 1500 };
......
......@@ -13,6 +13,7 @@ namespace RTC
{
/* Static. */
static uint8_t ClonedPacketBuffer[RTC::RtpBufferSize];
static constexpr uint64_t KeyFrameRequestBlockTimeout{ 1000 }; // In ms.
/* Instance methods. */
......@@ -184,6 +185,7 @@ namespace RTC
// Find the corresponding RtpStreamRecv.
uint32_t ssrc = packet->GetSsrc();
RTC::RtpStreamRecv* rtpStream{ nullptr };
std::unique_ptr<RTC::RtpPacket> clonedPacket;
if (this->rtpStreams.find(ssrc) != this->rtpStreams.end())
{
......@@ -208,6 +210,11 @@ namespace RTC
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.
if (packet->GetPayloadType() == rtpStream->GetPayloadType())
Codecs::ProcessRtpPacket(packet, rtpStream->GetMimeType());
......
......@@ -10,10 +10,6 @@
namespace RTC
{
/* Namespace variables. */
uint8_t RtpBuffer[RtpBufferSize];
/* Class methods. */
RtpPacket* RtpPacket::Parse(const uint8_t* data, size_t len)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论