AVPF TMMBR/TMMBN: set correct ssrc to handle TMMBR in one-way video calls

parent d9edcd15
......@@ -487,6 +487,8 @@ ORTP_PUBLIC uint16_t rtcp_XR_voip_metrics_get_jb_abs_max(const mblk_t *m);
ORTP_PUBLIC bool_t rtcp_is_RTPFB(const mblk_t *m);
ORTP_PUBLIC rtcp_rtpfb_type_t rtcp_RTPFB_get_type(const mblk_t *m);
ORTP_PUBLIC rtcp_fb_tmmbr_fci_t * rtcp_RTPFB_tmmbr_get_fci(const mblk_t *m);
ORTP_PUBLIC uint32_t rtcp_RTPFB_get_packet_sender_ssrc(const mblk_t *m);
ORTP_PUBLIC uint32_t rtcp_RTPFB_get_media_source_ssrc(const mblk_t *m);
/* RTCP PSFB accessors */
ORTP_PUBLIC bool_t rtcp_is_PSFB(const mblk_t *m);
......
......@@ -617,7 +617,7 @@ ORTP_PUBLIC void rtp_session_send_rtcp_fb_fir(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_rtcp_fb_sli(RtpSession *session, uint16_t first, uint16_t number, uint8_t picture_id);
ORTP_PUBLIC void rtp_session_send_rtcp_fb_rpsi(RtpSession *session, uint8_t *bit_string, uint16_t bit_string_len);
ORTP_PUBLIC void rtp_session_send_rtcp_fb_tmmbr(RtpSession *session, uint64_t mxtbr);
ORTP_PUBLIC void rtp_session_send_rtcp_fb_tmmbn(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_rtcp_fb_tmmbn(RtpSession *session, uint32_t ssrc);
/*private */
......
......@@ -210,7 +210,7 @@ static mblk_t * make_rtcp_fb_tmmbr(RtpSession *session, uint64_t mxtbr, uint16_t
return h;
}
static mblk_t * make_rtcp_fb_tmmbn(RtpSession *session) {
static mblk_t * make_rtcp_fb_tmmbn(RtpSession *session, uint32_t ssrc) {
int size = sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t) + sizeof(rtcp_fb_tmmbr_fci_t);
mblk_t *h = allocb(size, 0);
rtcp_common_header_t *ch;
......@@ -229,7 +229,7 @@ static mblk_t * make_rtcp_fb_tmmbn(RtpSession *session) {
fbh->packet_sender_ssrc = htonl(rtp_session_get_send_ssrc(session));
fbh->media_source_ssrc = htonl(0);
memcpy(fci, rtcp_RTPFB_tmmbr_get_fci(session->rtcp.tmmbr_info.received), sizeof(rtcp_fb_tmmbr_fci_t));
fci->ssrc = htonl(rtp_session_get_recv_ssrc(session));
fci->ssrc = htonl(ssrc);
/* Fill common header */
rtcp_common_header_init(ch, session, RTCP_RTPFB, RTCP_RTPFB_TMMBN, msgdsize(h));
......@@ -320,10 +320,10 @@ void rtp_session_send_rtcp_fb_tmmbr(RtpSession *session, uint64_t mxtbr) {
}
}
void rtp_session_send_rtcp_fb_tmmbn(RtpSession *session) {
void rtp_session_send_rtcp_fb_tmmbn(RtpSession *session, uint32_t ssrc) {
mblk_t *m;
if ((rtp_session_avpf_enabled(session) == TRUE) && (rtp_session_avpf_feature_enabled(session, ORTP_AVPF_FEATURE_TMMBR) == TRUE)) {
m = make_rtcp_fb_tmmbn(session);
m = make_rtcp_fb_tmmbn(session, ssrc);
if (m) {
rtp_session_add_fb_packet_to_send(session, m);
session->rtcp.send_algo.tmmbn_scheduled = TRUE;
......
......@@ -532,6 +532,16 @@ rtcp_rtpfb_type_t rtcp_RTPFB_get_type(const mblk_t *m) {
return (rtcp_rtpfb_type_t)rtcp_common_header_get_rc(ch);
}
uint32_t rtcp_RTPFB_get_packet_sender_ssrc(const mblk_t *m) {
rtcp_fb_header_t *fbh = (rtcp_fb_header_t *)(m->b_rptr + sizeof(rtcp_common_header_t));
return ntohl(fbh->packet_sender_ssrc);
}
uint32_t rtcp_RTPFB_get_media_source_ssrc(const mblk_t *m) {
rtcp_fb_header_t *fbh = (rtcp_fb_header_t *)(m->b_rptr + sizeof(rtcp_common_header_t));
return ntohl(fbh->media_source_ssrc);
}
rtcp_fb_tmmbr_fci_t * rtcp_RTPFB_tmmbr_get_fci(const mblk_t *m) {
unsigned int size = sizeof(rtcp_common_header_t) + sizeof(rtcp_fb_header_t) + sizeof(rtcp_fb_tmmbr_fci_t);
unsigned int rtcp_size = rtcp_get_size(m);
......
......@@ -115,7 +115,7 @@ static int set_multicast_group(ortp_socket_t sock, const char *addr){
ortp_warning ("Error in getaddrinfo on (addr=%s): %s", addr, gai_strerror(err));
return -1;
}
switch (res->ai_family){
case AF_INET:
if (IN_MULTICAST(ntohl(((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr)))
......@@ -204,7 +204,7 @@ static ortp_socket_t create_and_bind(const char *addr, int *port, int *sock_fami
ortp_warning ("Fail to IPV6_V6ONLY: %s.",getSocketError());
}
}
#if defined(ORTP_TIMESTAMP)
optval=1;
err = setsockopt (sock, SOL_SOCKET, SO_TIMESTAMP,
......@@ -1024,7 +1024,7 @@ int _ortp_sendto(ortp_socket_t sockfd, mblk_t *m, int flags, const struct sockad
int _rtp_session_sendto(RtpSession *session, bool_t is_rtp, mblk_t *m, int flags, const struct sockaddr *destaddr, socklen_t destlen){
int ret;
if (session->net_sim_ctx && (session->net_sim_ctx->params.mode==OrtpNetworkSimulatorOutbound
|| session->net_sim_ctx->params.mode==OrtpNetworkSimulatorOutboundControlled)){
ret=msgdsize(m);
......@@ -1350,7 +1350,7 @@ static void handle_rtcp_rtpfb_packet(RtpSession *session, mblk_t *block) {
case RTCP_RTPFB_TMMBR:
if (session->rtcp.tmmbr_info.received) freemsg(session->rtcp.tmmbr_info.received);
session->rtcp.tmmbr_info.received = copymsg(block);
rtp_session_send_rtcp_fb_tmmbn(session);
rtp_session_send_rtcp_fb_tmmbn(session, rtcp_RTPFB_get_packet_sender_ssrc(block));
notify_tmmbr_received(session, block);
break;
case RTCP_RTPFB_TMMBN:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment