Commit 9762409e authored by Ghislain MARY's avatar Ghislain MARY

Add parsing of TMMBR SDP attribute.

parent 7fe6d9d3
......@@ -66,7 +66,8 @@ typedef enum _belle_sdp_rtcp_fb_val_param {
BELLE_SDP_RTCP_FB_SLI,
BELLE_SDP_RTCP_FB_RPSI,
BELLE_SDP_RTCP_FB_APP,
BELLE_SDP_RTCP_FB_FIR
BELLE_SDP_RTCP_FB_FIR,
BELLE_SDP_RTCP_FB_TMMBR
} belle_sdp_rtcp_fb_val_param_t;
typedef struct _belle_sdp_rtcp_fb_attribute belle_sdp_rtcp_fb_attribute_t;
BELLESIP_EXPORT belle_sdp_rtcp_fb_attribute_t* belle_sdp_rtcp_fb_attribute_new();
......@@ -80,6 +81,8 @@ BELLESIP_EXPORT belle_sdp_rtcp_fb_val_param_t belle_sdp_rtcp_fb_attribute_get_pa
BELLESIP_EXPORT void belle_sdp_rtcp_fb_attribute_set_param(belle_sdp_rtcp_fb_attribute_t* attribute, belle_sdp_rtcp_fb_val_param_t param);
BELLESIP_EXPORT uint16_t belle_sdp_rtcp_fb_attribute_get_trr_int(const belle_sdp_rtcp_fb_attribute_t* attribute);
BELLESIP_EXPORT void belle_sdp_rtcp_fb_attribute_set_trr_int(belle_sdp_rtcp_fb_attribute_t* attribute, uint16_t milliseconds);
BELLESIP_EXPORT uint32_t belle_sdp_rtcp_fb_attribute_get_smaxpr(const belle_sdp_rtcp_fb_attribute_t* attribute);
BELLESIP_EXPORT void belle_sdp_rtcp_fb_attribute_set_smaxpr(belle_sdp_rtcp_fb_attribute_t* attribute, uint32_t smaxpr);
#define BELLE_SDP_RTCP_FB_ATTRIBUTE(t) BELLE_SDP_CAST(t,belle_sdp_rtcp_fb_attribute_t)
/***************************************************************************************
* RTCP-XR Attribute
......
......@@ -167,6 +167,7 @@ struct _belle_sdp_rtcp_fb_attribute {
belle_sdp_attribute_t base;
belle_sdp_rtcp_fb_val_type_t type;
belle_sdp_rtcp_fb_val_param_t param;
uint32_t smaxpr;
uint16_t trr_int;
int8_t id;
};
......@@ -185,6 +186,7 @@ void belle_sdp_rtcp_fb_attribute_clone(belle_sdp_rtcp_fb_attribute_t* attribute,
attribute->param = orig->param;
attribute->trr_int = orig->trr_int;
attribute->id = orig->id;
attribute->smaxpr = orig->smaxpr;
}
belle_sip_error_code belle_sdp_rtcp_fb_attribute_marshal(belle_sdp_rtcp_fb_attribute_t* attribute, char * buff, size_t buff_size, size_t *offset) {
int8_t id = belle_sdp_rtcp_fb_attribute_get_id(attribute);
......@@ -245,6 +247,12 @@ belle_sip_error_code belle_sdp_rtcp_fb_attribute_marshal(belle_sdp_rtcp_fb_attri
case BELLE_SDP_RTCP_FB_FIR:
error = belle_sip_snprintf(buff, buff_size, offset, " fir");
break;
case BELLE_SDP_RTCP_FB_TMMBR:
error = belle_sip_snprintf(buff, buff_size, offset, " tmmbr");
if (belle_sdp_rtcp_fb_attribute_get_smaxpr(attribute) > 0) {
error = belle_sip_snprintf(buff, buff_size, offset, " smaxpr=%u", belle_sdp_rtcp_fb_attribute_get_smaxpr(attribute));
}
break;
default:
break;
}
......@@ -258,6 +266,7 @@ static void belle_sdp_rtcp_fb_attribute_init(belle_sdp_rtcp_fb_attribute_t* attr
attribute->type = BELLE_SDP_RTCP_FB_TRR_INT;
attribute->param = BELLE_SDP_RTCP_FB_NONE;
attribute->trr_int = 0;
attribute->smaxpr = 0;
}
BELLE_SDP_NEW_WITH_CTR(rtcp_fb_attribute,belle_sdp_attribute)
BELLE_SDP_PARSE(rtcp_fb_attribute)
......@@ -265,6 +274,7 @@ GET_SET_INT(belle_sdp_rtcp_fb_attribute,id,int8_t)
GET_SET_INT(belle_sdp_rtcp_fb_attribute,type,belle_sdp_rtcp_fb_val_type_t)
GET_SET_INT(belle_sdp_rtcp_fb_attribute,param,belle_sdp_rtcp_fb_val_param_t)
GET_SET_INT(belle_sdp_rtcp_fb_attribute,trr_int,uint16_t)
GET_SET_INT(belle_sdp_rtcp_fb_attribute,smaxpr,uint32_t)
/***************************************************************************************
* RTCP-XR Attribute
*
......
......@@ -377,6 +377,7 @@ rtcp_fb_app_param:
rtcp_fb_ccm_param:
(rtcp_fb_fir_param)=>rtcp_fb_fir_param
| (rtcp_fb_tmmbr_param)=>rtcp_fb_tmmbr_param
| (rtcp_fb_token_param)=>rtcp_fb_token_param;
rtcp_fb_fir_param:
......@@ -384,6 +385,18 @@ rtcp_fb_fir_param:
belle_sdp_rtcp_fb_attribute_set_param($rtcp_fb_attribute::current,BELLE_SDP_RTCP_FB_FIR);
};
rtcp_fb_tmmbr_param:
{IS_TOKEN(tmmbr)}? rtcp_fb_attribute_name /*'tmmbr'*/ (SPACE rtcp_fb_tmmbr_smaxpr_param)? {
belle_sdp_rtcp_fb_attribute_set_param($rtcp_fb_attribute::current,BELLE_SDP_RTCP_FB_TMMBR);
};
rtcp_fb_tmmbr_smaxpr_param:
{IS_TOKEN(smaxpr)}? rtcp_fb_attribute_name /*'smaxpr'*/ EQUAL val=rtcp_fb_tmmbr_smaxpr {
if (val.tree) belle_sdp_rtcp_fb_attribute_set_smaxpr($rtcp_fb_attribute::current,atoi((const char*)$rtcp_fb_tmmbr_smaxpr.text->chars));
};
rtcp_fb_tmmbr_smaxpr : DIGIT+;
rtcp_fb_token_param:
rtcp_fb_attribute_name (SPACE byte_string)?;
......
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