mgcp_sdp: restructure mgcp_write_response_sdp() (rtpmap)
The function mgcp_write_response_sdp() generates the rtpmap lines in the sdp response. Since we will likely support multiple codecs we will need to generate several rtpmap lines. Therefore it makes sense to split up that part in a separate function without altering the overall functionality (yet) - add static function add_rtpmap() to generate the rtpmap. Change-Id: I520e2d40fe6294c88bae63dfcbc5238ef98101e2 Related: OS#3442
This commit is contained in:
parent
fee4fa9492
commit
8482e8374c
|
@ -286,6 +286,24 @@ int mgcp_parse_sdp_data(const struct mgcp_endpoint *endp,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Add rtpmap string to the sdp payload, but only when the payload type falls
|
||||||
|
* into the dynamic payload type range */
|
||||||
|
static int add_rtpmap(struct msgb *sdp, int payload_type, const char *audio_name)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (payload_type >= 96 && payload_type <= 127) {
|
||||||
|
if (!audio_name)
|
||||||
|
return -EINVAL;
|
||||||
|
rc = msgb_printf(sdp, "a=rtpmap:%d %s\r\n", payload_type, audio_name);
|
||||||
|
if (rc < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Generate SDP response string.
|
/*! Generate SDP response string.
|
||||||
* \param[in] endp trunk endpoint.
|
* \param[in] endp trunk endpoint.
|
||||||
* \param[in] conn associated rtp connection.
|
* \param[in] conn associated rtp connection.
|
||||||
|
@ -328,12 +346,8 @@ int mgcp_write_response_sdp(const struct mgcp_endpoint *endp,
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto buffer_too_small;
|
goto buffer_too_small;
|
||||||
|
|
||||||
/* FIXME: Check if the payload type is from the static range,
|
if (endp->tcfg->audio_send_name) {
|
||||||
* if yes, omitthe a=rtpmap since it is unnecessary */
|
rc = add_rtpmap(sdp, payload_type, audio_name);
|
||||||
if (audio_name && endp->tcfg->audio_send_name && (payload_type >= 96 && payload_type <= 127)) {
|
|
||||||
rc = msgb_printf(sdp, "a=rtpmap:%d %s\r\n",
|
|
||||||
payload_type, audio_name);
|
|
||||||
|
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto buffer_too_small;
|
goto buffer_too_small;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue