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

Minimal code cleanup in RtpReceiver.cpp/RtpSender.cpp

上级 f8b61863
......@@ -87,11 +87,11 @@ namespace RTC
bool available = false;
// Whether this RtpSender has been disabled by the app.
bool disabled = false;
// RTP counters.
RTC::RtpDataCounter transmitted;
// Timestamp when last RTCP was sent.
uint64_t lastRtcpSentTime = 0;
uint16_t maxRtcpInterval;
// RTP counters.
RTC::RtpDataCounter transmittedCounter;
// TODO: keep track of retransmitted data too.
// RTC::RtpDataCounter retransmitted;
};
......@@ -142,7 +142,7 @@ namespace RTC
inline
uint32_t RtpSender::GetTransmissionRate(uint64_t now)
{
return this->transmitted.GetRate(now);
return this->transmittedCounter.GetRate(now);
}
}
......
......@@ -320,18 +320,13 @@ namespace RTC
return;
}
// Process the packet.
// TODO: Must check what kind of packet we are checking. For example, RTX
// packets (once implemented) should have a different handling.
if (!this->rtpStream->ReceivePacket(packet))
return;
// Map the payload type.
uint8_t payloadType = packet->GetPayloadType();
auto it = this->supportedPayloadTypes.find(payloadType);
// NOTE: This may happen if this peer supports just some codecs from the
// given RtpParameters.
// TODO: We should just ignore those packets as they have non been negotiated.
if (it == this->supportedPayloadTypes.end())
{
MS_DEBUG_TAG(rtp, "payload type not supported [payloadType:%" PRIu8 "]", payloadType);
......@@ -339,11 +334,17 @@ namespace RTC
return;
}
// Process the packet.
// TODO: Must check what kind of packet we are checking. For example, RTX
// packets (once implemented) should have a different handling.
if (!this->rtpStream->ReceivePacket(packet))
return;
// Send the packet.
this->transport->SendRtpPacket(packet);
// Save RTP data.
this->transmitted.Update(packet);
this->transmittedCounter.Update(packet);
}
void RtpSender::GetRtcp(RTC::RTCP::CompoundPacket *packet, uint64_t now)
......@@ -365,7 +366,7 @@ namespace RTC
report->SetSsrc(ssrc);
packet->AddSenderReport(report);
// Build sdes chunk for this sender.
// Build SDES chunk for this sender.
RTC::RTCP::SdesChunk *sdesChunk = new RTC::RTCP::SdesChunk(ssrc);
RTC::RTCP::SdesItem *sdesItem = new RTC::RTCP::SdesItem(RTC::RTCP::SdesItem::Type::CNAME, cname.size(), cname.c_str());
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论