diff options
author | Mark Michelson <mmichelson@digium.com> | 2017-04-26 16:14:00 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2017-04-27 15:03:51 -0500 |
commit | d6535c0080632bce5ed555904d5198c04e040ffb (patch) | |
tree | c473dd2aa7b2061b41f9b6559490dca215f811e8 /main/rtp_engine.c | |
parent | 413de95ab247ed9b48fc48f440e5c397146e07cb (diff) |
SDP API: Add SSRC-level attributes
RFC 5576 defines how SSRC-level attributes may be added to SDP media
descriptions. In general, this is useful for grouping related SSRCes,
indicating SSRC-level format attributes, and resolving collisions in RTP
SSRC values. These attributes are used widely by browsers during WebRTC
communications, including attributes defined by documents outside of RFC
5576.
This commit introduces the addition of SSRC-level attributes into SDPs
generated by Asterisk. Since Asterisk does not tend to use multiple
SSRCs on a media stream, the initial support is minimal. Asterisk
includes an SSRC-level CNAME attribute if configured to do so. This at
least gives browsers (and possibly others) the ability to resolve SSRC
collisions at offer-answer time.
In order to facilitate this, the RTP engine API has been enhanced to be
able to retrieve the SSRC and CNAME on a given RTP instance.
res_rtp_asterisk currently does not provide meaningful CNAME values in
its RTCP SDES items, and therefore it currently will always return an
empty string as the CNAME value. A task in the near future will result
in res_rtp_asterisk generating more meaningful CNAMEs.
Change-Id: I29e7f23e7db77524f82a3b6e8531b1195ff57789
Diffstat (limited to 'main/rtp_engine.c')
-rw-r--r-- | main/rtp_engine.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/main/rtp_engine.c b/main/rtp_engine.c index 82298901d..9cfae09f4 100644 --- a/main/rtp_engine.c +++ b/main/rtp_engine.c @@ -3340,3 +3340,29 @@ void ast_rtp_instance_set_last_rx(struct ast_rtp_instance *rtp, time_t time) { rtp->last_rx = time; } + +unsigned int ast_rtp_instance_get_ssrc(struct ast_rtp_instance *rtp) +{ + unsigned int ssrc = 0; + + ao2_lock(rtp); + if (rtp->engine->ssrc_get) { + ssrc = rtp->engine->ssrc_get(rtp); + } + ao2_unlock(rtp); + + return ssrc; +} + +const char *ast_rtp_instance_get_cname(struct ast_rtp_instance *rtp) +{ + const char *cname = ""; + + ao2_lock(rtp); + if (rtp->engine->cname_get) { + cname = rtp->engine->cname_get(rtp); + } + ao2_unlock(rtp); + + return cname; +} |