rtcp: Extract fraction and lost fields correctly from the report

This commit is contained in:
Aaro Altonen 2021-04-22 13:25:04 +03:00
parent bfaa3536c5
commit 6e53f686f9
3 changed files with 15 additions and 13 deletions

View File

@ -45,7 +45,7 @@ namespace uvgrtp {
uint32_t initial_rtp; /* RTP timestamp of the first RTP packet received */ uint32_t initial_rtp; /* RTP timestamp of the first RTP packet received */
uint32_t clock_rate; /* Rate of the clock (used for jitter calculations) */ uint32_t clock_rate; /* Rate of the clock (used for jitter calculations) */
uint32_t lsr; /* Middle 32 bits of the 64-bit NTP timestamp of previous SR */ uint32_t lsr; /* Middle 32 bits of the 64-bit NTP timestamp of previous SR */
uvgrtp::clock::hrc::hrc_t sr_ts; /* When the last SR was received (used to calculate delay) */ uvgrtp::clock::hrc::hrc_t sr_ts; /* When the last SR was received (used to calculate delay) */
uint16_t max_seq; /* Highest sequence number received */ uint16_t max_seq; /* Highest sequence number received */

View File

@ -75,12 +75,13 @@ rtp_error_t uvgrtp::rtcp::handle_receiver_report_packet(uint8_t *packet, size_t
for (int i = 0; i < frame->header.count; ++i) { for (int i = 0; i < frame->header.count; ++i) {
uvgrtp::frame::rtcp_report_block report; uvgrtp::frame::rtcp_report_block report;
report.ssrc = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 0]); report.ssrc = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 0]);
report.lost = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 4]); report.fraction = (ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 4])) >> 24;
report.last_seq = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 8]); report.lost = (ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 4])) & 0xfffffd;
report.jitter = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 12]); report.last_seq = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 8]);
report.lsr = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 16]); report.jitter = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 12]);
report.dlsr = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 20]); report.lsr = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 16]);
report.dlsr = ntohl(*(uint32_t *)&packet[(i * 24) + 8 + 20]);
frame->report_blocks.push_back(report); frame->report_blocks.push_back(report);
} }

View File

@ -76,12 +76,13 @@ rtp_error_t uvgrtp::rtcp::handle_sender_report_packet(uint8_t *packet, size_t si
for (int i = 0; i < frame->header.count; ++i) { for (int i = 0; i < frame->header.count; ++i) {
uvgrtp::frame::rtcp_report_block report; uvgrtp::frame::rtcp_report_block report;
report.ssrc = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 0]); report.ssrc = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 0]);
report.lost = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 4]); report.fraction = (ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 4])) >> 24;
report.last_seq = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 8]); report.lost = (ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 4])) & 0xfffffd;
report.jitter = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 12]); report.last_seq = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 8]);
report.lsr = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 16]); report.jitter = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 12]);
report.dlsr = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 20]); report.lsr = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 16]);
report.dlsr = ntohl(*(uint32_t *)&packet[(i * 24) + 28 + 20]);
frame->report_blocks.push_back(report); frame->report_blocks.push_back(report);
} }