rtcp: Add packet handler for RTCP PT 205 and 206 packets
This commit is contained in:
parent
04af2dfabd
commit
f9bc598286
|
@ -84,6 +84,8 @@ namespace uvgrtp {
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
/** \brief Subtype in APP packets. Alternative to count */
|
/** \brief Subtype in APP packets. Alternative to count */
|
||||||
uint8_t pkt_subtype;
|
uint8_t pkt_subtype;
|
||||||
|
/** \brief Feedback message type (FMT), specified in RFC 5104 section 4.3. Alternative to count and pkt_subtype */
|
||||||
|
uint8_t fmt;
|
||||||
};
|
};
|
||||||
/** \brief Identifies the RTCP packet type */
|
/** \brief Identifies the RTCP packet type */
|
||||||
uint8_t pkt_type = 0;
|
uint8_t pkt_type = 0;
|
||||||
|
@ -158,6 +160,13 @@ namespace uvgrtp {
|
||||||
/** \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 Feedback message. See RFC 5104 section 6.1 */
|
||||||
|
struct rtcp_fb_packet {
|
||||||
|
struct rtcp_header header;
|
||||||
|
uint32_t sender_ssrc = 0;
|
||||||
|
uint32_t media_ssrc = 0;
|
||||||
|
uint8_t* fci = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
PACK(struct zrtp_frame {
|
PACK(struct zrtp_frame {
|
||||||
uint8_t version:4;
|
uint8_t version:4;
|
||||||
|
|
|
@ -458,6 +458,8 @@ namespace uvgrtp {
|
||||||
uvgrtp::frame::rtcp_header& header);
|
uvgrtp::frame::rtcp_header& header);
|
||||||
rtp_error_t handle_app_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
|
rtp_error_t handle_app_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
|
||||||
uvgrtp::frame::rtcp_header& header);
|
uvgrtp::frame::rtcp_header& header);
|
||||||
|
rtp_error_t handle_fb_packet(uint8_t* buffer, size_t& read_ptr, size_t packet_end,
|
||||||
|
uvgrtp::frame::rtcp_header& header);
|
||||||
|
|
||||||
static void rtcp_runner(rtcp *rtcp);
|
static void rtcp_runner(rtcp *rtcp);
|
||||||
|
|
||||||
|
|
19
src/rtcp.cc
19
src/rtcp.cc
|
@ -1226,11 +1226,11 @@ rtp_error_t uvgrtp::rtcp::handle_incoming_packet(void* args, int rce_flags, uint
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uvgrtp::frame::RTCP_FT_RTPFB:
|
case uvgrtp::frame::RTCP_FT_RTPFB:
|
||||||
UVG_LOG_INFO("Received a transport-layer FB message");
|
ret = handle_fb_packet(buffer, read_ptr, packet_end, header);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uvgrtp::frame::RTCP_FT_PSFB:
|
case uvgrtp::frame::RTCP_FT_PSFB:
|
||||||
UVG_LOG_INFO("Received a payload-specific FB message");
|
ret = handle_fb_packet(buffer, read_ptr, packet_end, header);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1271,6 +1271,9 @@ void uvgrtp::rtcp::read_rtcp_header(const uint8_t* buffer, size_t& read_ptr, uvg
|
||||||
{
|
{
|
||||||
header.pkt_subtype = buffer[read_ptr] & 0x1f;
|
header.pkt_subtype = buffer[read_ptr] & 0x1f;
|
||||||
}
|
}
|
||||||
|
else if (header.pkt_type == uvgrtp::frame::RTCP_FT_RTPFB || header.pkt_type == uvgrtp::frame::RTCP_FT_PSFB) {
|
||||||
|
header.fmt = buffer[read_ptr] & 0x1f;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
header.count = buffer[read_ptr] & 0x1f;
|
header.count = buffer[read_ptr] & 0x1f;
|
||||||
}
|
}
|
||||||
|
@ -1583,6 +1586,18 @@ rtp_error_t uvgrtp::rtcp::handle_app_packet(uint8_t* packet, size_t& read_ptr,
|
||||||
return RTP_OK;
|
return RTP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtp_error_t uvgrtp::rtcp::handle_fb_packet(uint8_t* packet, size_t& read_ptr,
|
||||||
|
size_t packet_end, uvgrtp::frame::rtcp_header& header)
|
||||||
|
{
|
||||||
|
UVG_LOG_INFO("Received an RTCP FB message");
|
||||||
|
auto frame = new uvgrtp::frame::rtcp_fb_packet;
|
||||||
|
frame->header = header;
|
||||||
|
read_ssrc(packet, read_ptr, frame->sender_ssrc);
|
||||||
|
read_ssrc(packet, read_ptr, frame->media_ssrc);
|
||||||
|
|
||||||
|
return RTP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
rtp_error_t uvgrtp::rtcp::send_rtcp_packet_to_participants(uint8_t* frame, uint32_t frame_size, bool encrypt)
|
rtp_error_t uvgrtp::rtcp::send_rtcp_packet_to_participants(uint8_t* frame, uint32_t frame_size, bool encrypt)
|
||||||
{
|
{
|
||||||
if (!frame)
|
if (!frame)
|
||||||
|
|
Loading…
Reference in New Issue