rtcp: Refine the RTCP FB packet handler

This commit is contained in:
Heikki Tampio 2023-08-01 08:59:09 +03:00
parent e779941e44
commit 1d0f88bf70
2 changed files with 43 additions and 12 deletions

View File

@ -178,11 +178,17 @@ namespace uvgrtp {
struct rtcp_header header; struct rtcp_header header;
uint32_t sender_ssrc = 0; uint32_t sender_ssrc = 0;
uint32_t media_ssrc = 0; uint32_t media_ssrc = 0;
uint8_t* fci = nullptr; std::vector<uint32_t> items;
/** \brief Size of the payload in bytes. Added by uvgRTP to help process the payload. */ /** \brief Size of the payload in bytes. Added by uvgRTP to help process the payload. */
size_t payload_len = 0; size_t payload_len = 0;
}; };
/** \brief Full Intra Request (FIR), See RFC 5104 section 4.3.1 */
struct rtcp_fir_packet {
uint32_t ssrc = 0;
uint8_t seq = 0;
};
PACK(struct zrtp_frame { PACK(struct zrtp_frame {
uint8_t version:4; uint8_t version:4;
uint16_t unused:12; uint16_t unused:12;

View File

@ -1616,20 +1616,45 @@ rtp_error_t uvgrtp::rtcp::handle_fb_packet(uint8_t* packet, size_t& read_ptr,
UVG_LOG_INFO("Got an RTCP FB packet from a previously unknown participant SSRC %lu", frame->sender_ssrc); UVG_LOG_INFO("Got an RTCP FB packet from a previously unknown participant SSRC %lu", frame->sender_ssrc);
add_participant(frame->sender_ssrc); add_participant(frame->sender_ssrc);
} }
/* Payload-Specific Feedback Messages */
if (header.pkt_type == uvgrtp::frame::RTCP_FT_PSFB) {
/* Handle rest of the packet depending on the Feedback Message Type */
switch (header.fmt)
{
case uvgrtp::frame::RTCP_PSFB_PLI:
break;
// copy media ssrc and Feedback Control Information from network packet to RTCP structures case uvgrtp::frame::RTCP_PSFB_SLI:
read_ssrc(packet, read_ptr, frame->media_ssrc); break;
frame->payload_len = packet_end - read_ptr;
if (frame->payload_len > 0) case uvgrtp::frame::RTCP_PSFB_RPSI:
{ break;
// payload data is saved to fci
frame->fci = new uint8_t[frame->payload_len]; case uvgrtp::frame::RTCP_PSFB_FIR:
memcpy(frame->fci, &packet[read_ptr], frame->payload_len); break;
case uvgrtp::frame::RTCP_PSFB_TSTR:
break;
case uvgrtp::frame::RTCP_PSFB_AFB:
break;
default:
UVG_LOG_WARN("Unknown RTCP PSFB packet received, type %d", header.fmt);
break;
}
} }
else /* Transport-layer Feedback Messages */
{ else {
frame->fci = nullptr; switch (header.fmt)
{
case uvgrtp::frame::RTCP_RTPFB_NACK:
break;
default:
UVG_LOG_WARN("Unknown RTCP RTPFB packet received, type %d", header.fmt);
break;
}
} }
/* The last FB packet is not saved. If we want to do that, just save it in the participants_ map. */ /* The last FB packet is not saved. If we want to do that, just save it in the participants_ map. */
fb_mutex_.lock(); fb_mutex_.lock();