mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-18 01:04:13 +00:00
FS-7499: add enum for various rtcp related types
This commit is contained in:
1 parent
6f379f43c1
commit
1cd9e52b9e
2 files changed
+68
-18
No files matched your search
+16
-18
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user