FS-7499: add enum for various rtcp related types
This commit is contained in:
parent
6f379f43c1
commit
1cd9e52b9e
|
@ -111,6 +111,58 @@ typedef struct ice_s {
|
|||
|
||||
} ice_t;
|
||||
|
||||
typedef enum { /* RTCP Control Packet types (PT) http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-4 */
|
||||
RTCP_PT_IJ = 195, /* IJ: Extended inter-arrival jitter report RFC5450*/
|
||||
RTCP_PT_SR = 200, /* SR: sender report RFC3550 */
|
||||
RTCP_PT_RR = 201, /* RR: receiver report RFC3550 */
|
||||
RTCP_PT_SDES = 202, /* SDES: source description RFC3550 */
|
||||
RTPC_PT_BYE = 203, /* BYE: goodbye RFC3550 */
|
||||
RTCP_PT_APP = 204, /* APP: application-defined RFC3550 */
|
||||
RTCP_PT_RTPFB = 205, /* RTPFB: RTCP Transport layer FB message RFC4585 */
|
||||
RTCP_PT_PSFB = 206, /* PSFB: RTCP Payload-specific FB message RFC4585 */
|
||||
RTCP_PT_XR = 207, /* XR: extended report RFC3611 */
|
||||
RTCP_PT_AVB = 208, /* AVB: "Standard for Layer 3 Transport Protocol for Time Sensitive Applications in Local Area Networks." Work in progress. */
|
||||
RTCP_PT_RSI = 209, /* RSI: Receiver Summary Information RFC5760 */
|
||||
RTCP_PT_TOKEN = 210, /* TOKEN: Port Mapping RFC6284 */
|
||||
RTCP_PT_IDMS = 211, /* IDMS: IDMS Settings RFC7272 */
|
||||
RTCP_PT_LAST = 255 /* RESERVED */
|
||||
} rtcp_pt_t;
|
||||
|
||||
typedef enum { /* RTP SDES item types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-5 */
|
||||
RTCP_SDES_END = 0, /* END: end of sdes list RFC3550 */
|
||||
RTCP_SDES_CNAME = 1, /* CNAME: canonical name RFC3550 */
|
||||
RTCP_SDES_NAME = 2, /* NAME: user name RFC3550 */
|
||||
RTCP_SDES_EMAIL = 3, /* EMAIL: user's electronic mail address RFC3550 */
|
||||
RTCP_SDES_PHONE = 4, /* PHONE: user's phone number RFC3550 */
|
||||
RTCP_SDES_LOC = 5, /* LOC: geographic user location RFC3550 */
|
||||
RTCP_SDES_TOOL = 6, /* TOOL: name of application or tool RFC3550 */
|
||||
RTCP_SDES_NOTE = 7, /* NOTE: notice about the source RFC3550 */
|
||||
RTCP_SDES_PRIV = 8, /* PRIV: private extensions RFC3550 */
|
||||
RTCP_SDES_H323 = 9, /* H323-CADDR: H.323 callable address [Vineet Kumar] */
|
||||
RTCP_SDES_APSI = 10 /* APSI: Application specific identifer RFC6776 */
|
||||
} rtcp_sdes_t;
|
||||
|
||||
typedef enum { /* FMT Values for RTPFB Payload Types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-8 */
|
||||
RTCP_RTPFB_NACK = 1, /* Generic NACK: Generic negative acknowledgement RFC4585 */
|
||||
RTCP_RTPFB_TMMBR = 3, /* TMMBR: Temporary Maximum Media Stream Bit Rate Request RFC5104 */
|
||||
RTCP_RTPFB_TMMBN = 4, /* TMMBN: Temporary Maximum Media Stream Bit Rate Notification RFC5104 */
|
||||
RTCP_RTPFB_SR_REQ = 5, /* RTCP-SR-REQ: TCP Rapid Resynchronisation Request RFC6051*/
|
||||
RTCP_RTPFB_RAMS = 6, /* RAMS: Rapid Acquisition of Multicast Sessions RFC6285 */
|
||||
RTCP_RTPFB_TLLEI = 7, /* TLLEI: Transport-Layer Third-Party Loss Early Indication RFC6642 */
|
||||
RTCP_RTPFB_ECN_FB = 8 /* RTCP-ECN-FB: RTCP ECN Feedback RFC6679*/
|
||||
} rtcp_rtpfb_t;
|
||||
|
||||
typedef enum { /* FMT Values for PSFB Payload Types http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-9 */
|
||||
RTCP_PSFB_PLI = 1, /* PLI: Picture Loss Indication RFC4585 */
|
||||
RTCP_PSFB_SLI = 2, /* SLI: Slice Loss Indication RFC4585 */
|
||||
RTCP_PSFB_RPSI = 3, /* RPSI: Reference Picture Selection Indication RFC4585 */
|
||||
RTCP_PSFB_FIR = 4, /* FIR: Full Intra Request Command RFC5104 */
|
||||
RTCP_PSFB_TSTR = 5, /* TSTR: Temporal-Spatial Trade-off Request RFC5104 */
|
||||
RTCP_PSFB_TSTN = 6, /* TSTN: Temporal-Spatial Trade-off Notification RFC5104 */
|
||||
RTCP_PSFB_VBCM = 7, /* VBCM: Video Back Channel Message RFC5104 */
|
||||
RTCP_PSFB_PSLEI = 8, /* PSLEI: Payload-Specific Third-Party Loss Early Indication RFC6642*/
|
||||
RTCP_PSFB_AFB = 15 /* AFB Application layer FB */
|
||||
} rtcp_psfb_t;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1873,14 +1873,14 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
rtp_session->rtcp_send_msg.header.count = 1;
|
||||
|
||||
if (!rtp_session->stats.outbound.packet_count) {
|
||||
rtp_session->rtcp_send_msg.header.type = 201; /* Receiver report */
|
||||
rtp_session->rtcp_send_msg.header.type = RTCP_PT_RR; /* Receiver report */
|
||||
rr=(struct switch_rtcp_receiver_report*) rtp_session->rtcp_send_msg.body;
|
||||
rr->ssrc = htonl(rtp_session->ssrc);
|
||||
rtcp_report_block = &rr->report_block;
|
||||
rtcp_bytes += sizeof(struct switch_rtcp_report_block);
|
||||
} else {
|
||||
struct switch_rtcp_sender_info *rtcp_sender_info;
|
||||
rtp_session->rtcp_send_msg.header.type = 200; /* Sender report */
|
||||
rtp_session->rtcp_send_msg.header.type = RTCP_PT_SR; /* Sender report */
|
||||
sr = (struct switch_rtcp_sender_report*) rtp_session->rtcp_send_msg.body;
|
||||
sr->ssrc = htonl(rtp_session->ssrc);
|
||||
rtcp_sender_info = &sr->sender_info;
|
||||
|
@ -1909,8 +1909,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
|
||||
ext_hdr->version = 2;
|
||||
ext_hdr->p = 0;
|
||||
ext_hdr->fmt = 1;
|
||||
ext_hdr->pt = 206;
|
||||
ext_hdr->fmt = RTCP_PSFB_PLI;
|
||||
ext_hdr->pt = RTCP_PT_PSFB;
|
||||
|
||||
ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
|
||||
ext_hdr->recv_ssrc = htonl(rtp_session->remote_ssrc);
|
||||
|
@ -1930,8 +1930,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
|
||||
ext_hdr->version = 2;
|
||||
ext_hdr->p = 0;
|
||||
ext_hdr->fmt = 1;
|
||||
ext_hdr->pt = 205;
|
||||
ext_hdr->fmt = RTCP_RTPFB_NACK;
|
||||
ext_hdr->pt = RTCP_PT_RTPFB;
|
||||
ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
|
||||
ext_hdr->recv_ssrc = htonl(rtp_session->remote_ssrc);
|
||||
ext_hdr->length = htons(3);
|
||||
|
@ -1959,8 +1959,8 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
|
||||
ext_hdr->version = 2;
|
||||
ext_hdr->p = 0;
|
||||
ext_hdr->fmt = 4;
|
||||
ext_hdr->pt = 206;
|
||||
ext_hdr->fmt = RTCP_PSFB_FIR;
|
||||
ext_hdr->pt = RTCP_PT_PSFB;
|
||||
|
||||
ext_hdr->send_ssrc = htonl(rtp_session->ssrc);
|
||||
ext_hdr->recv_ssrc = 0;
|
||||
|
@ -1983,7 +1983,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
p = (uint8_t *) (&rtp_session->rtcp_send_msg) + rtcp_bytes;
|
||||
sdes = (switch_rtcp_hdr_t *) p;
|
||||
sdes->version = 2;
|
||||
sdes->type = 202;
|
||||
sdes->type = RTCP_PT_SDES;
|
||||
sdes->count = 1;
|
||||
sdes->p = 0;
|
||||
p = (uint8_t *) (sdes) + sdes_bytes;
|
||||
|
@ -1994,7 +1994,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
|
||||
p = (uint8_t *) (sdes) + sdes_bytes;
|
||||
unit = (switch_rtcp_sdes_unit_t *) p;
|
||||
unit->type = 1;
|
||||
unit->type = RTCP_SDES_CNAME;
|
||||
snprintf((char *)unit->value, 80, "%x", rtp_session->ssrc);
|
||||
unit->length = strlen((char *)unit->value);
|
||||
sdes_bytes += sizeof(switch_rtcp_sdes_unit_t) + unit->length;
|
||||
|
@ -2002,7 +2002,7 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
|||
|
||||
p += sizeof(switch_rtcp_sdes_unit_t) + unit->length;
|
||||
unit = (switch_rtcp_sdes_unit_t *) p;
|
||||
unit->type = 7;
|
||||
unit->type = RTCP_SDES_NOTE;
|
||||
snprintf((char *)unit->value, 80, "FreeSWITCH.org -- Come to ClueCon.com");
|
||||
unit->length = strlen((char *)unit->value);
|
||||
sdes_bytes += sizeof(switch_rtcp_sdes_unit_t) + unit->length;
|
||||
|
@ -5338,19 +5338,17 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
|
|||
"RTCP packet bytes %" SWITCH_SIZE_T_FMT " type %d pad %d\n",
|
||||
bytes, msg->header.type, msg->header.p);
|
||||
|
||||
if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] &&
|
||||
(msg->header.type == 205 || //RTPFB
|
||||
msg->header.type == 206)) {//PSFB
|
||||
if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && (msg->header.type == RTCP_PT_RTPFB || msg->header.type == RTCP_PT_PSFB)) {
|
||||
rtcp_ext_msg_t *extp = (rtcp_ext_msg_t *) msg;
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "PICKED UP XRTCP type: %d fmt: %d\n",
|
||||
msg->header.type, extp->header.fmt);
|
||||
|
||||
if (msg->header.type == 206 && (extp->header.fmt == 4 || extp->header.fmt == 1)) { /* FIR || PLI */
|
||||
if (msg->header.type == RTCP_PT_PSFB && (extp->header.fmt == RTCP_PSFB_FIR || extp->header.fmt == RTCP_PSFB_PLI)) {
|
||||
switch_core_media_gen_key_frame(rtp_session->session);
|
||||
//switch_channel_set_flag(switch_core_session_get_channel(rtp_session->session), CF_VIDEO_REFRESH_REQ);
|
||||
}
|
||||
|
||||
if (msg->header.type == 205 && extp->header.fmt == 1) { /*NACK*/
|
||||
if (msg->header.type == RTCP_PT_RTPFB && extp->header.fmt == RTCP_RTPFB_NACK) {
|
||||
uint32_t *nack = (uint32_t *) extp->body;
|
||||
int i;
|
||||
|
||||
|
@ -5364,7 +5362,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
|
|||
|
||||
} else
|
||||
|
||||
if (msg->header.type == 200 || msg->header.type == 201) {
|
||||
if (msg->header.type == RTCP_PT_SR || msg->header.type == RTCP_PT_RR) {
|
||||
struct switch_rtcp_report_block *report_block;
|
||||
switch_time_t now;
|
||||
switch_time_exp_t now_hr;
|
||||
|
@ -5377,7 +5375,7 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t
|
|||
ntp_usec = (uint32_t)(now - (sec*1000000)); /* micro seconds */
|
||||
lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; // 0.065536 is used for convertion from useconds
|
||||
|
||||
if (msg->header.type == 200) { /* Sender report */
|
||||
if (msg->header.type == RTCP_PT_SR) { /* Sender report */
|
||||
struct switch_rtcp_sender_report* sr = (struct switch_rtcp_sender_report*)msg->body;
|
||||
|
||||
report_block = &sr->report_block;
|
||||
|
|
Loading…
Reference in New Issue