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
This commit is contained in:
Matthew Jordan
2013-08-23 15:42:27 +00:00
parent e31bd332b8
commit 4d348e853c
11 changed files with 543 additions and 25 deletions

View File

@@ -849,7 +849,9 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
char tmp[512];
pj_str_t stmp;
pjmedia_sdp_attr *attr;
int index = 0, min_packet_size = 0, noncodec = (session->endpoint->dtmf == AST_SIP_DTMF_RFC_4733) ? AST_RTP_DTMF : 0;
int index = 0;
int noncodec = (session->endpoint->dtmf == AST_SIP_DTMF_RFC_4733) ? AST_RTP_DTMF : 0;
int min_packet_size = 0, max_packet_size = 0;
int rtp_code;
struct ast_format format;
RAII_VAR(struct ast_format_cap *, caps, NULL, ast_format_cap_destroy);
@@ -951,6 +953,10 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
if (fmt.cur_ms && ((fmt.cur_ms < min_packet_size) || !min_packet_size)) {
min_packet_size = fmt.cur_ms;
}
if (fmt.max_ms && ((fmt.max_ms < max_packet_size) || !max_packet_size)) {
max_packet_size = fmt.max_ms;
}
}
}
@@ -983,6 +989,12 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
media->attr[media->attr_count++] = attr;
}
if (max_packet_size) {
snprintf(tmp, sizeof(tmp), "%d", max_packet_size);
attr = pjmedia_sdp_attr_create(pool, "maxptime", pj_cstr(&stmp, tmp));
media->attr[media->attr_count++] = attr;
}
/* Add the sendrecv attribute - we purposely don't keep track because pjmedia-sdp will automatically change our offer for us */
attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
attr->name = STR_SENDRECV;