|
@@ -169,26 +169,27 @@ void RtcpReportBlock::preparePacket(SSRC in_ssrc, [[maybe_unused]] unsigned int
|
|
|
|
|
|
void RtcpReportBlock::setSSRC(SSRC in_ssrc) { _ssrc = htonl(in_ssrc); }
|
|
|
|
|
|
-void RtcpReportBlock::setPacketsLost([[maybe_unused]] unsigned int packetsLost,
|
|
|
- [[maybe_unused]] unsigned int totalPackets) {
|
|
|
- // TODO Implement loss percentages.
|
|
|
- _fractionLostAndPacketsLost = 0;
|
|
|
+void RtcpReportBlock::setPacketsLost(uint8_t fractionLost,
|
|
|
+ unsigned int packetsLostCount) {
|
|
|
+ _fractionLostAndPacketsLost = ( (uint32_t)fractionLost << 24) && htonl(packetsLostCount);
|
|
|
}
|
|
|
|
|
|
-unsigned int RtcpReportBlock::getLossPercentage() const {
|
|
|
- // TODO Implement loss percentages.
|
|
|
- return 0;
|
|
|
+uint8_t RtcpReportBlock::getFractionLost() const {
|
|
|
+ // Fraction lost is expressed as 8-bit fixed point number
|
|
|
+ // In order to get actual lost percentage divide the result by 256
|
|
|
+ return _fractionLostAndPacketsLost & 0xFF;
|
|
|
}
|
|
|
|
|
|
-unsigned int RtcpReportBlock::getPacketLostCount() const {
|
|
|
- // TODO Implement total packets lost.
|
|
|
- return 0;
|
|
|
+unsigned int RtcpReportBlock::getPacketsLostCount() const {
|
|
|
+ return ntohl(_fractionLostAndPacketsLost & 0xFFFFFF00);
|
|
|
}
|
|
|
|
|
|
uint16_t RtcpReportBlock::seqNoCycles() const { return ntohs(_seqNoCycles); }
|
|
|
|
|
|
uint16_t RtcpReportBlock::highestSeqNo() const { return ntohs(_highestSeqNo); }
|
|
|
|
|
|
+uint32_t RtcpReportBlock::extendedHighestSeqNo() const { return (seqNoCycles() << 16) | highestSeqNo(); }
|
|
|
+
|
|
|
uint32_t RtcpReportBlock::jitter() const { return ntohl(_jitter); }
|
|
|
|
|
|
uint32_t RtcpReportBlock::delaySinceSR() const { return ntohl(_delaySinceLastReport); }
|