mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
wip
Change-Id: I4e3fbcf85f3e1867aeb577681c7e32a01e56f2c4
This commit is contained in:
@@ -170,7 +170,7 @@ int sdp_parse_attrib(struct osmo_sdp_msg *sdp, const char *src)
|
||||
if (str_is_attrib(src, OSMO_SDP_STR_RTPMAP, ':')) {
|
||||
/* "a=rtpmap:96 AMR/8000" */
|
||||
struct token audio_name;
|
||||
unsigned int channels = 1;
|
||||
const char *slash;
|
||||
if (sscanf(src, OSMO_SDP_STR_RTPMAP ":%u", &payload_type) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -183,17 +183,23 @@ int sdp_parse_attrib(struct osmo_sdp_msg *sdp, const char *src)
|
||||
if (audio_name.start >= get_line_end(src))
|
||||
return -EINVAL;
|
||||
|
||||
audio_name.end = strchr(audio_name.start, '/');
|
||||
if (!audio_name.end || audio_name.end > line_end)
|
||||
audio_name.end = line_end;
|
||||
slash = strchr(audio_name.start, '/');
|
||||
|
||||
audio_name.end = slash ? : line_end;
|
||||
token_copy(codec, &codec->encoding_name, &audio_name);
|
||||
/* '< 1' is enough, the second '/%u' is optional */
|
||||
|
||||
if (audio_name.end >= line_end) {
|
||||
/* There should be a "/8000" here. If it is missing, let's not be strict about it. */
|
||||
codec->rate = 8000;
|
||||
} else {
|
||||
unsigned int channels = 1;
|
||||
if (sscanf(audio_name.end, "/%u/%u", &codec->rate, &channels) < 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (channels != 1)
|
||||
return -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
else if (str_is_attrib(src, OSMO_SDP_STR_FMTP, ':')) {
|
||||
/* "a=fmtp:112 octet-align=1;mode-set=0,1,2,3" */
|
||||
|
Reference in New Issue
Block a user