TT#50652 split out codec payload type init function

Change-Id: Ifd71439179925961f25c828132d7afb207a4f344
changes/39/27639/7
Richard Fuchs 7 years ago
parent 83965bdb1f
commit 3374254899

@ -812,6 +812,14 @@ struct rtp_payload_type *codec_make_payload_type(const str *codec_str, struct ca
const codec_def_t *def = codec_find(&ret->encoding, 0);
ret->codec_def = def;
codec_init_payload_type(ret, media);
return ret;
}
void codec_init_payload_type(struct rtp_payload_type *ret, struct call_media *media) {
const codec_def_t *def = ret->codec_def;
#ifdef WITH_TRANSCODING
if (def) {
if (!ret->clock_rate)
@ -848,13 +856,13 @@ struct rtp_payload_type *codec_make_payload_type(const str *codec_str, struct ca
char params[32] = "";
if (ret->channels > 1) {
snprintf(full_encoding, sizeof(full_encoding), STR_FORMAT "/%u/%i", STR_FMT(&codec),
snprintf(full_encoding, sizeof(full_encoding), STR_FORMAT "/%u/%i", STR_FMT(&ret->encoding),
ret->clock_rate,
ret->channels);
snprintf(params, sizeof(params), "%i", ret->channels);
}
else
snprintf(full_encoding, sizeof(full_encoding), STR_FORMAT "/%u", STR_FMT(&codec),
snprintf(full_encoding, sizeof(full_encoding), STR_FORMAT "/%u", STR_FMT(&ret->encoding),
ret->clock_rate);
str_init(&ret->encoding_with_params, full_encoding);
@ -862,8 +870,6 @@ struct rtp_payload_type *codec_make_payload_type(const str *codec_str, struct ca
if (media)
__rtp_payload_type_dup(media->call, ret);
return ret;
}

@ -46,6 +46,7 @@ void codec_rtp_payload_types(struct call_media *media, struct call_media *other_
// special return value `(void *) 0x1` to signal type mismatch
struct rtp_payload_type *codec_make_payload_type(const str *codec_str, struct call_media *media);
void codec_init_payload_type(struct rtp_payload_type *, struct call_media *);
// used by redis

Loading…
Cancel
Save