Skip to content

Commit

Permalink
TT#50652 split out codec payload type init function
Browse files Browse the repository at this point in the history
Change-Id: Ifd71439179925961f25c828132d7afb207a4f344
  • Loading branch information
rfuchs committed Mar 6, 2019
1 parent 83965bd commit 3374254
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions daemon/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -848,22 +856,20 @@ 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);
str_init(&ret->encoding_parameters, params);

if (media)
__rtp_payload_type_dup(media->call, ret);

return ret;
}


Expand Down
1 change: 1 addition & 0 deletions include/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3374254

Please sign in to comment.