[svn-commits] coreyfarrell: branch coreyfarrell/media_formats-next r417208 - in /team/corey...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jun 25 02:42:52 CDT 2014
Author: coreyfarrell
Date: Wed Jun 25 02:42:44 2014
New Revision: 417208
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417208
Log:
res_rtp_asterisk and other fixes
Review: https://reviewboard.asterisk.org/r/3671/
Modified:
team/coreyfarrell/media_formats-next/addons/chan_mobile.c
team/coreyfarrell/media_formats-next/addons/chan_ooh323.c
team/coreyfarrell/media_formats-next/channels/chan_alsa.c
team/coreyfarrell/media_formats-next/channels/chan_gtalk.c
team/coreyfarrell/media_formats-next/channels/chan_h323.c
team/coreyfarrell/media_formats-next/channels/chan_jingle.c
team/coreyfarrell/media_formats-next/channels/chan_mgcp.c
team/coreyfarrell/media_formats-next/channels/chan_motif.c
team/coreyfarrell/media_formats-next/channels/chan_nbs.c
team/coreyfarrell/media_formats-next/channels/chan_oss.c
team/coreyfarrell/media_formats-next/channels/chan_pjsip.c
team/coreyfarrell/media_formats-next/channels/chan_sip.c
team/coreyfarrell/media_formats-next/channels/chan_skinny.c
team/coreyfarrell/media_formats-next/channels/chan_unistim.c
team/coreyfarrell/media_formats-next/include/asterisk/codec.h
team/coreyfarrell/media_formats-next/include/asterisk/format.h
team/coreyfarrell/media_formats-next/main/bridge.c
team/coreyfarrell/media_formats-next/main/channel.c
team/coreyfarrell/media_formats-next/main/codec.c
team/coreyfarrell/media_formats-next/main/codec_builtin.c
team/coreyfarrell/media_formats-next/main/format.c
team/coreyfarrell/media_formats-next/main/frame.c
team/coreyfarrell/media_formats-next/main/translate.c
team/coreyfarrell/media_formats-next/res/res_rtp_asterisk.c
team/coreyfarrell/media_formats-next/res/res_speech.c
Modified: team/coreyfarrell/media_formats-next/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/addons/chan_mobile.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/addons/chan_mobile.c (original)
+++ team/coreyfarrell/media_formats-next/addons/chan_mobile.c Wed Jun 25 02:42:44 2014
@@ -901,7 +901,7 @@
return NULL;
}
- if (!(ast_format_cap_iscompatible_format(cap, DEVICE_FRAME_FORMAT))) {
+ if (ast_format_cap_iscompatible_format(cap, DEVICE_FRAME_FORMAT) == AST_FORMAT_CMP_NOT_EQUAL) {
char tmp[256];
ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), cap));
*cause = AST_CAUSE_FACILITY_NOT_IMPLEMENTED;
Modified: team/coreyfarrell/media_formats-next/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/addons/chan_ooh323.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/addons/chan_ooh323.c (original)
+++ team/coreyfarrell/media_formats-next/addons/chan_ooh323.c Wed Jun 25 02:42:44 2014
@@ -1191,7 +1191,7 @@
}
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
if (ast_format_cap_count(ast_channel_nativeformats(ast))) {
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
@@ -4956,7 +4956,7 @@
if (f && p->owner && !p->faxmode && (f->frametype == AST_FRAME_VOICE)) {
/* We already hold the channel lock */
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, voice format changed to %s\n", ast_format_get_name(f->subclass.format));
Modified: team/coreyfarrell/media_formats-next/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_alsa.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_alsa.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_alsa.c Wed Jun 25 02:42:44 2014
@@ -620,7 +620,7 @@
char buf[256];
struct ast_channel *tmp = NULL;
- if (!ast_format_cap_iscompatible_format(cap, ast_format_slin)) {
+ if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
return NULL;
}
Modified: team/coreyfarrell/media_formats-next/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_gtalk.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_gtalk.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_gtalk.c Wed Jun 25 02:42:44 2014
@@ -1636,7 +1636,7 @@
if (p->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format)) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));
@@ -1682,7 +1682,7 @@
switch (frame->frametype) {
case AST_FRAME_VOICE:
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
Modified: team/coreyfarrell/media_formats-next/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_h323.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_h323.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_h323.c Wed Jun 25 02:42:44 2014
@@ -795,7 +795,7 @@
if (f && pvt->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!ast_format_cap_iscompatible_format(ast_channel_nativeformats(pvt->owner), f->subclass.format)) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(pvt->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *nativeformats;
nativeformats = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
@@ -883,7 +883,7 @@
return 0;
}
} else {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(c), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(c), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char tmp[256];
ast_log(LOG_WARNING, "Asked to transmit frame type '%s', while native formats is '%s' (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
Modified: team/coreyfarrell/media_formats-next/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_jingle.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_jingle.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_jingle.c Wed Jun 25 02:42:44 2014
@@ -1253,7 +1253,7 @@
if (p->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));
@@ -1299,7 +1299,7 @@
switch (frame->frametype) {
case AST_FRAME_VOICE:
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
Modified: team/coreyfarrell/media_formats-next/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_mgcp.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_mgcp.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_mgcp.c Wed Jun 25 02:42:44 2014
@@ -1200,7 +1200,7 @@
if (sub->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), f->subclass.format)) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));
@@ -1261,7 +1261,7 @@
return 0;
}
} else {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
Modified: team/coreyfarrell/media_formats-next/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_motif.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_motif.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_motif.c Wed Jun 25 02:42:44 2014
@@ -1672,8 +1672,8 @@
}
if (frame && frame->frametype == AST_FRAME_VOICE &&
- !ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format)) {
- if (!ast_format_cap_iscompatible_format(session->jointcap, frame->subclass.format)) {
+ ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cap_iscompatible_format(session->jointcap, frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n",
ast_format_get_name(frame->subclass.format), ast_channel_name(ast));
ast_frfree(frame);
@@ -1707,7 +1707,7 @@
switch (frame->frametype) {
case AST_FRAME_VOICE:
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
Modified: team/coreyfarrell/media_formats-next/channels/chan_nbs.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_nbs.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_nbs.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_nbs.c Wed Jun 25 02:42:44 2014
@@ -231,7 +231,7 @@
struct nbs_pvt *p;
struct ast_channel *tmp = NULL;
- if (!(ast_format_cap_iscompatible_format(cap, ast_format_slin))) {
+ if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
char tmp[256];
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), cap));
return NULL;
Modified: team/coreyfarrell/media_formats-next/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_oss.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_oss.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_oss.c Wed Jun 25 02:42:44 2014
@@ -863,7 +863,7 @@
/* XXX we could default to 'dsp' perhaps ? */
return NULL;
}
- if (!ast_format_cap_iscompatible_format(cap, ast_format_slin)) {
+ if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
return NULL;
}
Modified: team/coreyfarrell/media_formats-next/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_pjsip.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_pjsip.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_pjsip.c Wed Jun 25 02:42:44 2014
@@ -591,7 +591,7 @@
return f;
}
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));
@@ -639,7 +639,7 @@
if (!media) {
return 0;
}
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char buf[256];
ast_log(LOG_WARNING,
@@ -1144,8 +1144,7 @@
/* FIXME: Only use this for VP8. Additional work would have to be done to
* fully support other video codecs */
- if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast),
- ast_format_vp8)) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp8) != AST_FORMAT_CMP_NOT_EQUAL) {
/* 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 */
Modified: team/coreyfarrell/media_formats-next/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_sip.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_sip.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_sip.c Wed Jun 25 02:42:44 2014
@@ -7375,7 +7375,7 @@
ast_log(AST_LOG_NOTICE, "Ignoring ${SIP_CODEC*} variable because of unrecognized/not configured codec %s (check allow/disallow in sip.conf)\n", codec);
continue;
}
- if (ast_format_cap_iscompatible_format(original_jointcaps, fmt)) {
+ if (ast_format_cap_iscompatible_format(original_jointcaps, fmt) != AST_FORMAT_CMP_NOT_EQUAL) {
if (first_codec) {
ast_verb(4, "Set codec to '%s' for this call because of ${SIP_CODEC*} variable\n", codec);
ast_format_cap_remove_bytype(p->jointcaps, AST_MEDIA_TYPE_UNKNOWN);
@@ -7443,7 +7443,7 @@
switch (frame->frametype) {
case AST_FRAME_VOICE:
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char s1[512];
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
ast_format_get_name(frame->subclass.format),
@@ -7956,7 +7956,7 @@
if (p->vrtp && !p->novideo) {
/* FIXME: Only use this for VP8. Additional work would have to be done to
* fully support other video codecs */
- if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp8)) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), ast_format_vp8) != AST_FORMAT_CMP_NOT_EQUAL) {
/* 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 */
@@ -8570,10 +8570,10 @@
return f;
}
- if (f && !ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format)) {
+ if (f && ast_format_cap_iscompatible_format(ast_channel_nativeformats(p->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
- if (!ast_format_cap_iscompatible_format(p->jointcaps, f->subclass.format)) {
+ if (ast_format_cap_iscompatible_format(p->jointcaps, f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n",
ast_format_get_name(f->subclass.format), ast_channel_name(p->owner));
ast_frfree(f);
@@ -10849,7 +10849,7 @@
ast_verbose("Peer T.140 RTP is at port %s\n",
ast_sockaddr_stringify(tsa));
}
- if (ast_format_cap_iscompatible_format(p->jointcaps, ast_format_t140_red)) {
+ if (ast_format_cap_iscompatible_format(p->jointcaps, ast_format_t140_red) != AST_FORMAT_CMP_NOT_EQUAL) {
p->red = 1;
ast_rtp_red_init(p->trtp, 300, red_data_pt, 2);
} else {
@@ -13443,7 +13443,7 @@
tmp_fmt = ast_format_cap_get_format(p->prefcaps, x);
if ((ast_format_get_type(tmp_fmt) != AST_MEDIA_TYPE_AUDIO) ||
- (!ast_format_cap_iscompatible_format(tmpcap, tmp_fmt))) {
+ (ast_format_cap_iscompatible_format(tmpcap, tmp_fmt) == AST_FORMAT_CMP_NOT_EQUAL)) {
ao2_ref(tmp_fmt, -1);
continue;
}
@@ -13458,7 +13458,7 @@
for (x = 0; x < ast_format_cap_count(p->caps); x++) {
tmp_fmt = ast_format_cap_get_format(p->caps, x);
- if (ast_format_cap_iscompatible_format(alreadysent, tmp_fmt)) {
+ if (ast_format_cap_iscompatible_format(alreadysent, tmp_fmt) != AST_FORMAT_CMP_NOT_EQUAL) {
ao2_ref(tmp_fmt, -1);
continue;
}
@@ -13479,7 +13479,7 @@
for (x = 0; x < ast_format_cap_count(tmpcap); x++) {
tmp_fmt = ast_format_cap_get_format(tmpcap, x);
- if (ast_format_cap_iscompatible_format(alreadysent, tmp_fmt)) {
+ if (ast_format_cap_iscompatible_format(alreadysent, tmp_fmt) != AST_FORMAT_CMP_NOT_EQUAL) {
ao2_ref(tmp_fmt, -1);
continue;
}
Modified: team/coreyfarrell/media_formats-next/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_skinny.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_skinny.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_skinny.c Wed Jun 25 02:42:44 2014
@@ -5062,7 +5062,7 @@
if (ast) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format_cap *caps;
ast_debug(1, "Oooh, format changed to %s\n", ast_format_get_name(f->subclass.format));
@@ -5103,7 +5103,7 @@
return 0;
}
} else {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char buf[256];
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(frame->subclass.format),
Modified: team/coreyfarrell/media_formats-next/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/channels/chan_unistim.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/channels/chan_unistim.c (original)
+++ team/coreyfarrell/media_formats-next/channels/chan_unistim.c Wed Jun 25 02:42:44 2014
@@ -2884,7 +2884,7 @@
sin.sin_port = htons(find_rtp_port(sub));
ast_sockaddr_from_sin(&sin_tmp, &sin);
ast_rtp_instance_set_remote_address(sub->rtp, &sin_tmp);
- if (!ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), ast_channel_readformat(sub->owner))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), ast_channel_readformat(sub->owner)) == AST_FORMAT_CMP_NOT_EQUAL) {
struct ast_format *tmpfmt;
char tmp[256];
tmpfmt = ast_format_cap_get_format(ast_channel_nativeformats(sub->owner), 0);
@@ -5134,7 +5134,7 @@
if (sub->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), f->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(sub->owner), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char tmp[256];
struct ast_format_cap *caps;
@@ -5184,7 +5184,7 @@
return 0;
}
} else {
- if (!(ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format))) {
+ if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), frame->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
char tmp[256];
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
Modified: team/coreyfarrell/media_formats-next/include/asterisk/codec.h
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/include/asterisk/codec.h?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/include/asterisk/codec.h (original)
+++ team/coreyfarrell/media_formats-next/include/asterisk/codec.h Wed Jun 25 02:42:44 2014
@@ -72,7 +72,7 @@
*/
int (*get_length)(unsigned int samples);
/*! \brief Whether the media can be smoothed or not */
- unsigned int smooth:1;
+ unsigned int smooth;
};
/*!
@@ -160,6 +160,8 @@
*/
const char *ast_codec_media_type2str(enum ast_media_type type);
+/*unsigned int ast_codec_sample_count(struct ast_codec *codec);*/
+
/*!
* \brief Get the number of samples contained within a frame
*
Modified: team/coreyfarrell/media_formats-next/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/include/asterisk/format.h?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/include/asterisk/format.h (original)
+++ team/coreyfarrell/media_formats-next/include/asterisk/format.h Wed Jun 25 02:42:44 2014
@@ -170,7 +170,7 @@
*
* \note The returned format must be treated as immutable.
*/
-struct ast_format *ast_format_copy(struct ast_format *format);
+#define ast_format_copy(format) ao2_bump(format)
/*!
* \brief Set an attribute on a format to a specific value
@@ -258,6 +258,16 @@
const char *ast_format_get_codec_name(const struct ast_format *format);
/*!
+ * \brief Get whether or not the format can be smoothed
+ *
+ * \param format The media format
+ *
+ * \retval 0 the format cannot be smoothed
+ * \retval 1 the format can be smoothed
+ */
+int ast_format_can_be_smoothed(const struct ast_format *format);
+
+/*!
* \brief Get the media type of a format
*
* \param format The media format
@@ -311,16 +321,6 @@
* \return length of media (in milliseconds)
*/
unsigned int ast_format_determine_length(const struct ast_format *format, unsigned int samples);
-
-/*!
- * \brief Check if the format is signed linear
- *
- * \param format The media format
- *
- * \retval 1 format is signed linear
- * \retval 0 format is not signed linear
- */
-int ast_format_is_slinear(const struct ast_format *format);
/*!
* \since 12
Modified: team/coreyfarrell/media_formats-next/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/bridge.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/bridge.c (original)
+++ team/coreyfarrell/media_formats-next/main/bridge.c Wed Jun 25 02:42:44 2014
@@ -943,7 +943,7 @@
write_format = ast_channel_writeformat(bridge_channel->chan);
/* Are the formats currently in use something this bridge can handle? */
- if (!ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, read_format)) {
+ if (ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, read_format) == AST_FORMAT_CMP_NOT_EQUAL) {
best_format = ast_format_cap_get_format(bridge->technology->format_capabilities, 0);
/* Read format is a no go... */
@@ -967,7 +967,7 @@
ast_format_get_name(read_format));
}
- if (!ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, write_format)) {
+ if (ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, write_format) == AST_FORMAT_CMP_NOT_EQUAL) {
best_format = ast_format_cap_get_format(bridge->technology->format_capabilities, 0);
/* Write format is a no go... */
Modified: team/coreyfarrell/media_formats-next/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/channel.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/channel.c (original)
+++ team/coreyfarrell/media_formats-next/main/channel.c Wed Jun 25 02:42:44 2014
@@ -4113,7 +4113,7 @@
ast_frfree(f);
f = &ast_null_frame;
}
- } else if ((f->frametype == AST_FRAME_VOICE) && !ast_format_cap_iscompatible_format(ast_channel_nativeformats(chan), f->subclass.format)) {
+ } else if ((f->frametype == AST_FRAME_VOICE) && ast_format_cap_iscompatible_format(ast_channel_nativeformats(chan), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
/* This frame is not one of the current native formats -- drop it on the floor */
char to[200];
ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n",
@@ -5032,7 +5032,7 @@
if (ast_format_cmp(fr->subclass.format, ast_channel_rawwriteformat(chan)) != AST_FORMAT_CMP_NOT_EQUAL) {
f = fr;
} else {
- if ((!ast_format_cap_iscompatible_format(ast_channel_nativeformats(chan), fr->subclass.format)) &&
+ if ((ast_format_cap_iscompatible_format(ast_channel_nativeformats(chan), fr->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) &&
(ast_format_cmp(ast_channel_writeformat(chan), fr->subclass.format) != AST_FORMAT_CMP_EQUAL)) {
char nf[512];
Modified: team/coreyfarrell/media_formats-next/main/codec.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/codec.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/codec.c (original)
+++ team/coreyfarrell/media_formats-next/main/codec.c Wed Jun 25 02:42:44 2014
@@ -345,6 +345,9 @@
return 0;
}
+ /* BUGBUG - why not just get the codec pointer off the format?
+ This is a bit roundabout
+ */
codec = ast_codec_get_by_id(ast_format_get_codec_id(frame->subclass.format));
if (codec->samples_count) {
Modified: team/coreyfarrell/media_formats-next/main/codec_builtin.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/codec_builtin.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/codec_builtin.c (original)
+++ team/coreyfarrell/media_formats-next/main/codec_builtin.c Wed Jun 25 02:42:44 2014
@@ -123,6 +123,7 @@
.default_ms = 20,
.samples_count = ulaw_samples,
.get_length = ulaw_length,
+ .smooth = 1,
};
static struct ast_codec alaw = {
@@ -135,6 +136,7 @@
.default_ms = 20,
.samples_count = ulaw_samples,
.get_length = ulaw_length,
+ .smooth = 1,
};
static int gsm_samples(struct ast_frame *frame)
@@ -157,6 +159,7 @@
.default_ms = 20,
.samples_count = gsm_samples,
.get_length = gsm_length,
+ .smooth = 1,
};
static int g726_samples(struct ast_frame *frame)
@@ -179,6 +182,7 @@
.default_ms = 20,
.samples_count = g726_samples,
.get_length = g726_length,
+ .smooth = 1,
};
static struct ast_codec g726aal2 = {
@@ -191,6 +195,7 @@
.default_ms = 20,
.samples_count = g726_samples,
.get_length = g726_length,
+ .smooth = 1,
};
static struct ast_codec adpcm = {
@@ -203,6 +208,7 @@
.default_ms = 20,
.samples_count = g726_samples,
.get_length = g726_length,
+ .smooth = 1,
};
static int slin_samples(struct ast_frame *frame)
@@ -225,6 +231,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin12 = {
@@ -237,6 +244,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin16 = {
@@ -249,6 +257,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin24 = {
@@ -261,6 +270,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin32 = {
@@ -273,6 +283,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin44 = {
@@ -285,6 +296,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin48 = {
@@ -297,6 +309,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin96 = {
@@ -309,6 +322,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static struct ast_codec slin192 = {
@@ -321,6 +335,7 @@
.default_ms = 20,
.samples_count = slin_samples,
.get_length = slin_length,
+ .smooth = 1,
};
static int lpc10_samples(struct ast_frame *frame)
@@ -342,6 +357,7 @@
.maximum_ms = 20,
.default_ms = 20,
.samples_count = lpc10_samples,
+ .smooth = 1,
};
static int g729_samples(struct ast_frame *frame)
@@ -364,6 +380,7 @@
.default_ms = 20,
.samples_count = g729_samples,
.get_length = g729_length,
+ .smooth = 1,
};
static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
@@ -537,6 +554,7 @@
.maximum_ms = 30,
.default_ms = 30,
.samples_count = ilbc_samples,
+ .smooth = 1,
};
static struct ast_codec g722 = {
@@ -549,6 +567,7 @@
.default_ms = 20,
.samples_count = g726_samples,
.get_length = g726_length,
+ .smooth = 1,
};
static int siren7_samples(struct ast_frame *frame)
@@ -605,6 +624,7 @@
.default_ms = 20,
.samples_count = ulaw_samples,
.get_length = ulaw_length,
+ .smooth = 1,
};
static int g719_samples(struct ast_frame *frame)
Modified: team/coreyfarrell/media_formats-next/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/format.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/format.c (original)
+++ team/coreyfarrell/media_formats-next/main/format.c Wed Jun 25 02:42:44 2014
@@ -197,6 +197,10 @@
enum ast_format_cmp_res ast_format_cmp(const struct ast_format *format1, const struct ast_format *format2)
{
+ if (format1 == NULL || format2 == NULL) {
+ return AST_FORMAT_CMP_NOT_EQUAL;
+ }
+
if (format1 == format2) {
return AST_FORMAT_CMP_EQUAL;
}
@@ -230,11 +234,6 @@
return format1->interface->format_get_joint(format1, format2);
}
-struct ast_format *ast_format_copy(struct ast_format *format)
-{
- return ao2_bump(format);
-}
-
int ast_format_attribute_set(struct ast_format *format, const char *name, const char *value)
{
if (!format->interface || !format->interface->format_attribute_set) {
@@ -277,6 +276,11 @@
return format->codec->name;
}
+int ast_format_can_be_smoothed(const struct ast_format *format)
+{
+ return format->codec->smooth;
+}
+
enum ast_media_type ast_format_get_type(const struct ast_format *format)
{
return format->codec->type;
Modified: team/coreyfarrell/media_formats-next/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/frame.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/frame.c (original)
+++ team/coreyfarrell/media_formats-next/main/frame.c Wed Jun 25 02:42:44 2014
@@ -121,6 +121,8 @@
if ((fr->frametype == AST_FRAME_VOICE) || (fr->frametype == AST_FRAME_VIDEO) ||
(fr->frametype == AST_FRAME_IMAGE)) {
ao2_cleanup(fr->subclass.format);
+ } else {
+ memset(&fr->subclass, 0, sizeof(fr->subclass));
}
if (!fr->mallocd)
@@ -202,7 +204,12 @@
return NULL;
}
out->frametype = fr->frametype;
- out->subclass.format = ast_format_copy(fr->subclass.format);
+ if ((fr->frametype == AST_FRAME_VOICE) || (fr->frametype == AST_FRAME_VIDEO) ||
+ (fr->frametype == AST_FRAME_IMAGE)) {
+ out->subclass.format = ast_format_copy(fr->subclass.format);
+ } else {
+ memcpy(&out->subclass, &fr->subclass, sizeof(out->subclass));
+ }
out->datalen = fr->datalen;
out->samples = fr->samples;
out->offset = fr->offset;
@@ -309,7 +316,12 @@
}
out->frametype = f->frametype;
- out->subclass.format = ast_format_copy(f->subclass.format);
+ if ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_VIDEO) ||
+ (f->frametype == AST_FRAME_IMAGE)) {
+ out->subclass.format = ast_format_copy(f->subclass.format);
+ } else {
+ memcpy(&out->subclass, &f->subclass, sizeof(out->subclass));
+ }
out->datalen = f->datalen;
out->samples = f->samples;
out->delivery = f->delivery;
Modified: team/coreyfarrell/media_formats-next/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/main/translate.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/main/translate.c (original)
+++ team/coreyfarrell/media_formats-next/main/translate.c Wed Jun 25 02:42:44 2014
@@ -1408,15 +1408,13 @@
}
/* if this is not a desired format, nothing to do */
- if (ast_format_cap_iscompatible_format(
- dest, fmt) == AST_FORMAT_CMP_NOT_EQUAL) {
+ if (ast_format_cap_iscompatible_format(dest, fmt) == AST_FORMAT_CMP_NOT_EQUAL) {
continue;
}
/* if the source is supplying this format, then
we can leave it in the result */
- if (ast_format_cap_iscompatible_format(
- src, fmt) == AST_FORMAT_CMP_EQUAL) {
+ if (ast_format_cap_iscompatible_format(src, fmt) == AST_FORMAT_CMP_EQUAL) {
continue;
}
Modified: team/coreyfarrell/media_formats-next/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/coreyfarrell/media_formats-next/res/res_rtp_asterisk.c?view=diff&rev=417208&r1=417207&r2=417208
==============================================================================
--- team/coreyfarrell/media_formats-next/res/res_rtp_asterisk.c (original)
+++ team/coreyfarrell/media_formats-next/res/res_rtp_asterisk.c Wed Jun 25 02:42:44 2014
@@ -56,6 +56,7 @@
#include "asterisk/stun.h"
#include "asterisk/pbx.h"
#include "asterisk/frame.h"
+#include "asterisk/format_cache.h"
#include "asterisk/channel.h"
#include "asterisk/acl.h"
#include "asterisk/config.h"
@@ -207,8 +208,8 @@
unsigned int cycles; /*!< Shifted count of sequence number cycles */
double rxjitter; /*!< Interarrival jitter at the moment in seconds */
double rxtransit; /*!< Relative transit time for previous packet */
- struct ast_format lasttxformat;
- struct ast_format lastrxformat;
+ struct ast_format *lasttxformat;
+ struct ast_format *lastrxformat;
int rtptimeout; /*!< RTP timeout time (negative or zero means disabled, negative value means temporarily disabled) */
int rtpholdtimeout; /*!< RTP timeout when on hold (negative or zero means disabled, negative value means temporarily disabled). */
@@ -1679,7 +1680,11 @@
static int rtp_get_rate(struct ast_format *format)
{
- return (format->id == AST_FORMAT_G722) ? 8000 : ast_format_rate(format);
+ /* For those wondering: due to a fluke in RFC publication, G.722 is advertised
+ * as having a sample rate of 8kHz, while implementations must know that its
+ * real rate is 16kHz. Seriously.
+ */
+ return (ast_format_cmp(format, ast_format_g722) == AST_FORMAT_CMP_EQUAL) ? 8000 : (int)ast_format_get_sample_rate(format);
}
static unsigned int ast_rtcp_calc_interval(struct ast_rtp *rtp)
@@ -2106,6 +2111,9 @@
}
#endif
+ ao2_cleanup(rtp->lasttxformat);
+ ao2_cleanup(rtp->lastrxformat);
+
/* Destroy synchronization items */
ast_mutex_destroy(&rtp->lock);
ast_cond_destroy(&rtp->cond);
@@ -2285,7 +2293,7 @@
rtp->dtmfmute = ast_tvadd(ast_tvnow(), ast_tv(0, 500000));
- if (duration > 0 && (measured_samples = duration * rtp_get_rate(&rtp->f.subclass.format) / 1000) > rtp->send_duration) {
+ if (duration > 0 && (measured_samples = duration * rtp_get_rate(rtp->f.subclass.format) / 1000) > rtp->send_duration) {
ast_debug(2, "Adjusting final end duration from %d to %u\n", rtp->send_duration, measured_samples);
rtp->send_duration = measured_samples;
}
@@ -2461,7 +2469,7 @@
int fraction_lost;
struct timeval dlsr = { 0, };
char bdata[512];
- int rate = rtp_get_rate(&rtp->f.subclass.format);
+ int rate = rtp_get_rate(rtp->f.subclass.format);
int ice;
int header_offset = 0;
struct ast_sockaddr remote_address = { {0,} };
@@ -2632,9 +2640,9 @@
int pred, mark = 0;
unsigned int ms = calc_txstamp(rtp, &frame->delivery);
struct ast_sockaddr remote_address = { {0,} };
- int rate = rtp_get_rate(&frame->subclass.format) / 1000;
-
- if (frame->subclass.format.id == AST_FORMAT_G722) {
[... 318 lines stripped ...]
More information about the svn-commits
mailing list