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

RtpStream: rewordings

上级 d0e6c9fe
...@@ -72,7 +72,7 @@ namespace RTC ...@@ -72,7 +72,7 @@ namespace RTC
virtual void Pause() = 0; virtual void Pause() = 0;
virtual void Resume() = 0; virtual void Resume() = 0;
void ResetScore(uint8_t score, bool notify); void ResetScore(uint8_t score, bool notify);
uint32_t GetRate(uint64_t now); uint32_t GetBitrate(uint64_t now);
uint8_t GetFractionLost() const; uint8_t GetFractionLost() const;
float GetLossPercentage() const; float GetLossPercentage() const;
uint64_t GetMaxPacketMs() const; uint64_t GetMaxPacketMs() const;
...@@ -103,10 +103,10 @@ namespace RTC ...@@ -103,10 +103,10 @@ namespace RTC
uint32_t packetsLost{ 0 }; uint32_t packetsLost{ 0 };
uint8_t fractionLost{ 0 }; uint8_t fractionLost{ 0 };
size_t packetsDiscarded{ 0 }; size_t packetsDiscarded{ 0 };
size_t packetsRepaired{ 0 };
size_t packetsRetransmitted{ 0 }; size_t packetsRetransmitted{ 0 };
size_t packetsRepaired{ 0 };
size_t nackCount{ 0 }; size_t nackCount{ 0 };
size_t nackRtpPacketCount{ 0 }; size_t nackPacketCount{ 0 };
size_t pliCount{ 0 }; size_t pliCount{ 0 };
size_t firCount{ 0 }; size_t firCount{ 0 };
size_t repairedPrior{ 0 }; // Packets repaired at last interval. size_t repairedPrior{ 0 }; // Packets repaired at last interval.
...@@ -183,7 +183,7 @@ namespace RTC ...@@ -183,7 +183,7 @@ namespace RTC
return this->params.temporalLayers; return this->params.temporalLayers;
} }
inline uint32_t RtpStream::GetRate(uint64_t now) inline uint32_t RtpStream::GetBitrate(uint64_t now)
{ {
return this->transmissionCounter.GetRate(now); return this->transmissionCounter.GetRate(now);
} }
......
...@@ -29,6 +29,7 @@ namespace RTC ...@@ -29,6 +29,7 @@ namespace RTC
void FillJsonStats(json& jsonObject) override; void FillJsonStats(json& jsonObject) override;
bool ReceivePacket(RTC::RtpPacket* packet) override; bool ReceivePacket(RTC::RtpPacket* packet) override;
bool ReceiveRtxPacket(RTC::RtpPacket* packet); bool ReceiveRtxPacket(RTC::RtpPacket* packet);
uint32_t GetRate(uint64_t now);
RTC::RTCP::ReceiverReport* GetRtcpReceiverReport(); RTC::RTCP::ReceiverReport* GetRtcpReceiverReport();
void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report); void ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report);
void RequestKeyFrame(); void RequestKeyFrame();
......
...@@ -222,7 +222,7 @@ namespace RTC ...@@ -222,7 +222,7 @@ namespace RTC
{ {
auto& rtpStream = kv.second; auto& rtpStream = kv.second;
rate += rtpStream->GetRate(now); rate += rtpStream->GetBitrate(now);
} }
return rate; return rate;
......
...@@ -52,22 +52,23 @@ namespace RTC ...@@ -52,22 +52,23 @@ namespace RTC
uint64_t now = DepLibUV::GetTime(); uint64_t now = DepLibUV::GetTime();
jsonObject["timestamp"] = now; jsonObject["timestamp"] = now;
jsonObject["ssrc"] = this->params.ssrc; jsonObject["ssrc"] = this->params.ssrc;
jsonObject["kind"] = RtpCodecMimeType::type2String[this->params.mimeType.type]; jsonObject["kind"] = RtpCodecMimeType::type2String[this->params.mimeType.type];
jsonObject["mimeType"] = this->params.mimeType.ToString(); jsonObject["mimeType"] = this->params.mimeType.ToString();
jsonObject["packetCount"] = this->transmissionCounter.GetPacketCount(); jsonObject["packetCount"] = this->transmissionCounter.GetPacketCount();
jsonObject["byteCount"] = this->transmissionCounter.GetBytes(); jsonObject["byteCount"] = this->transmissionCounter.GetBytes();
jsonObject["bitrate"] = this->transmissionCounter.GetRate(now); jsonObject["bitrate"] = this->transmissionCounter.GetRate(now);
jsonObject["packetsLost"] = this->packetsLost; jsonObject["packetsLost"] = this->packetsLost;
jsonObject["fractionLost"] = this->fractionLost; jsonObject["fractionLost"] = this->fractionLost;
jsonObject["packetsDiscarded"] = this->packetsDiscarded; jsonObject["packetsDiscarded"] = this->packetsDiscarded;
jsonObject["packetsRepaired"] = this->packetsRepaired; jsonObject["packetsRetransmitted"] = this->packetsRetransmitted;
jsonObject["nackCount"] = this->nackCount; jsonObject["packetsRepaired"] = this->packetsRepaired;
jsonObject["nackRtpPacketCount"] = this->nackRtpPacketCount; jsonObject["nackCount"] = this->nackCount;
jsonObject["pliCount"] = this->pliCount; jsonObject["nackPacketCount"] = this->nackPacketCount;
jsonObject["firCount"] = this->firCount; jsonObject["pliCount"] = this->pliCount;
jsonObject["score"] = this->score; jsonObject["firCount"] = this->firCount;
jsonObject["score"] = this->score;
if (!this->params.rid.empty()) if (!this->params.rid.empty())
jsonObject["rid"] = this->params.rid; jsonObject["rid"] = this->params.rid;
......
...@@ -70,12 +70,13 @@ namespace RTC ...@@ -70,12 +70,13 @@ namespace RTC
if (packet->GetPayloadType() == GetPayloadType()) if (packet->GetPayloadType() == GetPayloadType())
RTC::Codecs::ProcessRtpPacket(packet, GetMimeType()); RTC::Codecs::ProcessRtpPacket(packet, GetMimeType());
// Pass the packet to the NackGenerator. // Pass the packet to the NackGenerator if there is no RTX, so if the
if (this->params.useNack && this->nackGenerator->ReceivePacket(packet)) // NackGenerator returns true it means that it was a NACKed packet.
if (this->params.useNack && !HasRtx() && this->nackGenerator->ReceivePacket(packet))
{ {
// Mark the packet as retransmitted and repaired. // Mark the packet as retransmitted and repaired.
RTC::RtpStream::PacketRepaired(packet);
RTC::RtpStream::PacketRetransmitted(packet); RTC::RtpStream::PacketRetransmitted(packet);
RTC::RtpStream::PacketRepaired(packet);
} }
// Ensure the inactivityCheckPeriodicTimer runs (unless DTX is enabled). // Ensure the inactivityCheckPeriodicTimer runs (unless DTX is enabled).
...@@ -85,6 +86,7 @@ namespace RTC ...@@ -85,6 +86,7 @@ namespace RTC
this->inactivityCheckPeriodicTimer->Restart(); this->inactivityCheckPeriodicTimer->Restart();
} }
// Increase transmission counter.
this->transmissionCounter.Update(packet); this->transmissionCounter.Update(packet);
return true; return true;
...@@ -513,7 +515,7 @@ namespace RTC ...@@ -513,7 +515,7 @@ namespace RTC
} }
this->nackCount++; this->nackCount++;
this->nackRtpPacketCount += numPacketsRequested; this->nackPacketCount += numPacketsRequested;
packet.Serialize(RTC::RTCP::Buffer); packet.Serialize(RTC::RTCP::Buffer);
......
...@@ -63,6 +63,9 @@ namespace RTC ...@@ -63,6 +63,9 @@ namespace RTC
if (!this->storage.empty()) if (!this->storage.empty())
StorePacket(packet); StorePacket(packet);
// Increase transmission counter.
this->transmissionCounter.Update(packet);
return true; return true;
} }
...@@ -76,7 +79,7 @@ namespace RTC ...@@ -76,7 +79,7 @@ namespace RTC
{ {
RTC::RTCP::FeedbackRtpNackItem* item = *it; RTC::RTCP::FeedbackRtpNackItem* item = *it;
this->nackRtpPacketCount += item->CountRequestedPackets(); this->nackPacketCount += item->CountRequestedPackets();
FillRetransmissionContainer(item->GetPacketId(), item->GetLostPacketBitmask()); FillRetransmissionContainer(item->GetPacketId(), item->GetLostPacketBitmask());
......
...@@ -318,7 +318,7 @@ namespace RTC ...@@ -318,7 +318,7 @@ namespace RTC
if (!IsActive()) if (!IsActive())
return 0u; return 0u;
return this->rtpStream->GetRate(now); return this->rtpStream->GetBitrate(now);
} }
float SimpleConsumer::GetLossPercentage() const float SimpleConsumer::GetLossPercentage() const
......
...@@ -490,7 +490,7 @@ namespace RTC ...@@ -490,7 +490,7 @@ namespace RTC
if (!IsActive()) if (!IsActive())
return 0u; return 0u;
return this->rtpStream->GetRate(now); return this->rtpStream->GetBitrate(now);
} }
float SimulcastConsumer::GetLossPercentage() const float SimulcastConsumer::GetLossPercentage() const
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论