diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-10-29 18:43:06 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-10-29 18:43:06 +0100 |
commit | c9b82b677e939727f9dee299ce6e876191385a5d (patch) | |
tree | 057a895a178359aeee354cd64a40d3da5bfae0e0 | |
parent | b576ea027970338a418be2adb831c2dcf6484b2b (diff) |
add support for EBU-ACIP parameters
add support for EBU-ACIP parameters in the SDP. This can be
enabled with the following config item:
sdp_ebuacip yes
Reference: https://tech.ebu.ch/docs/tech/tech3368.pdf
Thanks to Ola Palm from Swedish Radio for the patch
-rw-r--r-- | include/baresip.h | 7 | ||||
-rw-r--r-- | src/audio.c | 34 | ||||
-rw-r--r-- | src/config.c | 8 |
3 files changed, 49 insertions, 0 deletions
diff --git a/include/baresip.h b/include/baresip.h index e394e75..efa047c 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -248,6 +248,11 @@ struct config_bfcp { }; #endif +/** SDP */ +struct config_sdp { + bool ebuacip; /**< Enable EBU-ACIP parameters */ +}; + /** Core configuration */ struct config { @@ -268,6 +273,8 @@ struct config { #ifdef USE_VIDEO struct config_bfcp bfcp; #endif + + struct config_sdp sdp; }; int config_parse_conf(struct config *cfg, const struct conf *conf); diff --git a/src/audio.c b/src/audio.c index 116ffaa..422926b 100644 --- a/src/audio.c +++ b/src/audio.c @@ -746,6 +746,33 @@ static int add_telev_codec(struct audio *a) } +/* + * EBU ACIP (Audio Contribution over IP) Profile + */ +static int set_ebuacip_params(struct audio *au, uint32_t ptime) +{ + struct sdp_media *sdp = stream_sdpmedia(au->strm); + int jb_id; + int jbvalue; + int err = 0; + + jb_id = 0; + jbvalue = (au->strm->cfg.jbuf_del.max) * ptime; + + /* set ebuacip version */ + err |= sdp_media_set_lattr(sdp, false, "ebuacip", "version %i", 0); + + /* set jb option, only one in our case */ + err |= sdp_media_set_lattr(sdp, false, "ebuacip", "jb %i", jb_id); + + /* define jb value in option */ + err |= sdp_media_set_lattr(sdp, false, "ebuacip", + "jbdef %i fixed %d", jb_id, jbvalue); + + return err; +} + + int audio_alloc(struct audio **ap, const struct stream_param *stream_prm, const struct config *cfg, struct call *call, struct sdp_session *sdp_sess, int label, @@ -803,6 +830,13 @@ int audio_alloc(struct audio **ap, const struct stream_param *stream_prm, goto out; } + if (cfg->sdp.ebuacip) { + + err = set_ebuacip_params(a, ptime); + if (err) + goto out; + } + /* Audio codecs */ for (le = list_head(aucodecl); le; le = le->next) { err = add_audio_codec(a, stream_sdpmedia(a->strm), le->data); diff --git a/src/config.c b/src/config.c index 6662b3c..be26798 100644 --- a/src/config.c +++ b/src/config.c @@ -95,6 +95,11 @@ static struct config core_config = { "" }, #endif + + /* SDP */ + { + false + }, }; @@ -254,6 +259,9 @@ int config_parse_conf(struct config *cfg, const struct conf *conf) sizeof(cfg->bfcp.proto)); #endif + /* SDP */ + (void)conf_get_bool(conf, "sdp_ebuacip", &cfg->sdp.ebuacip); + return err; } |