diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-08-23 15:42:27 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-08-23 15:42:27 +0000 |
commit | 4d348e853cbd9ba7bc976487bfcb352a84e5ece0 (patch) | |
tree | fdf289e34cd706884aed7a262409fc3cdcba9bd1 /channels/chan_pjsip.c | |
parent | e31bd332b83f0245ce8bd6626279e1b9c683ec18 (diff) |
Add pass through support for Opus and VP8; Opus format attribute negotiation
This patch adds pass through support for Opus and VP8. That includes:
* Format attribute negotiation for Opus. Note that unlike some other codecs,
the draft RFC specifies having spaces delimiting the attributes in addition
to ';', so you have "attra=X; attrb=Y". This broke the attribute parsing in
chan_sip, so a small tweak was also included in this patch for that.
* A format attribute negotiation module for Opus, res_format_attr_opus
* Fast picture update for VP8. Since VP8 uses a different RTCP packet number
than FIR, this really is specific to VP8 at this time.
Note that the format attribute negotiation in res_pjsip_sdp_rtp was written
by mjordan. The rest of this patch was written completely by Lorenzo Miniero.
Review: https://reviewboard.asterisk.org/r/2723/
(closes issue ASTERISK-21981)
Reported by: Tzafrir Cohen
patches:
asterisk_opus+vp8_passthrough_20130718.patch uploaded by lminiero (License 6518)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397526 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r-- | channels/chan_pjsip.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index df6e9a385..c2fc5feba 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1168,10 +1168,25 @@ static int chan_pjsip_indicate(struct ast_channel *ast, int condition, const voi case AST_CONTROL_VIDUPDATE: media = pvt->media[SIP_MEDIA_VIDEO]; if (media && media->rtp) { - ao2_ref(channel->session, +1); + /* FIXME: Only use this for VP8. Additional work would have to be done to + * fully support other video codecs */ + struct ast_format_cap *fcap = ast_channel_nativeformats(ast); + struct ast_format vp8; + ast_format_set(&vp8, AST_FORMAT_VP8, 0); + if (ast_format_cap_iscompatible(fcap, &vp8)) { + /* FIXME Fake RTP write, this will be sent as an RTCP packet. Ideally the + * RTP engine would provide a way to externally write/schedule RTCP + * packets */ + struct ast_frame fr; + fr.frametype = AST_FRAME_CONTROL; + fr.subclass.integer = AST_CONTROL_VIDUPDATE; + res = ast_rtp_instance_write(media->rtp, &fr); + } else { + ao2_ref(channel->session, +1); - if (ast_sip_push_task(channel->session->serializer, transmit_info_with_vidupdate, channel->session)) { - ao2_cleanup(channel->session); + if (ast_sip_push_task(channel->session->serializer, transmit_info_with_vidupdate, channel->session)) { + ao2_cleanup(channel->session); + } } } else { res = -1; |