[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r301727 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 12 18:27:37 CST 2011


Author: dvossel
Date: Wed Jan 12 18:27:31 2011
New Revision: 301727

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=301727
Log:
ulaw and alaw translators

Modified:
    team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_alaw.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_ulaw.c
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_alaw.h
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_ulaw.h
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/slin.h
    team/dvossel/fixtheworld_phase1_step3/main/channel.c
    team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
    team/dvossel/fixtheworld_phase1_step3/main/frame.c
    team/dvossel/fixtheworld_phase1_step3/main/translate.c

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c Wed Jan 12 18:27:31 2011
@@ -5468,6 +5468,7 @@
 	p->jointcaps = ast_cap_destroy(p->jointcaps);
 	p->peercaps = ast_cap_destroy(p->peercaps);
 	p->redircaps = ast_cap_destroy(p->redircaps);
+	p->prefcaps = ast_cap_destroy(p->prefcaps);
 }
 
 /*! \brief  update_call_counter: Handle call_limit for SIP devices
@@ -7174,12 +7175,14 @@
 	p->jointcaps = ast_cap_alloc();
 	p->peercaps = ast_cap_alloc();
 	p->redircaps = ast_cap_alloc();
+	p->prefcaps = ast_cap_alloc();
 
 	if (!p->caps|| !p->jointcaps || !p->peercaps || !p->redircaps) {
 		p->caps = ast_cap_destroy(p->caps);
 		p->jointcaps = ast_cap_destroy(p->jointcaps);
 		p->peercaps = ast_cap_destroy(p->peercaps);
 		p->redircaps = ast_cap_destroy(p->redircaps);
+		p->prefcaps = ast_cap_destroy(p->prefcaps);
 		ao2_t_ref(p, -1, "Yuck, couldn't allocate cc_params struct. Get rid o' p");
 		return NULL;
 	}

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_alaw.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_alaw.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_alaw.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_alaw.c Wed Jan 12 18:27:31 2011
@@ -73,8 +73,6 @@
 
 static struct ast_translator alawtolin = {
 	.name = "alawtolin",
-	.srcfmt = AST_FORMAT_ALAW,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.framein = alawtolin_framein,
 	.sample = alaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -83,8 +81,6 @@
 
 static struct ast_translator lintoalaw = {
 	"lintoalaw",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_ALAW,
 	.framein = lintoalaw_framein,
 	.sample = slin8_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -101,6 +97,12 @@
 static int unload_module(void)
 {
 	int res;
+
+	ast_format_set(&lintoalaw.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&lintoalaw.dst_format, AST_FORMAT_ALAW, 0);
+
+	ast_format_set(&alawtolin.src_format, AST_FORMAT_ALAW, 0);
+	ast_format_set(&alawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
 
 	res = ast_unregister_translator(&lintoalaw);
 	res |= ast_unregister_translator(&alawtolin);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_ulaw.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_ulaw.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_ulaw.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_ulaw.c Wed Jan 12 18:27:31 2011
@@ -78,8 +78,6 @@
 
 static struct ast_translator ulawtolin = {
 	.name = "ulawtolin",
-	.srcfmt = AST_FORMAT_ULAW,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.framein = ulawtolin_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -88,8 +86,6 @@
 
 static struct ast_translator testlawtolin = {
 	.name = "testlawtolin",
-	.srcfmt = AST_FORMAT_TESTLAW,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.framein = ulawtolin_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -102,8 +98,6 @@
 
 static struct ast_translator lintoulaw = {
 	.name = "lintoulaw",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_ULAW,
 	.framein = lintoulaw_framein,
 	.sample = slin8_sample,
 	.buf_size = BUFFER_SAMPLES,
@@ -112,8 +106,6 @@
 
 static struct ast_translator lintotestlaw = {
 	.name = "lintotestlaw",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_TESTLAW,
 	.framein = lintoulaw_framein,
 	.sample = slin8_sample,
 	.buf_size = BUFFER_SAMPLES,
@@ -141,6 +133,18 @@
 {
 	int res;
 
+	ast_format_set(&lintoulaw.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&lintoulaw.dst_format, AST_FORMAT_ULAW, 0);
+
+	ast_format_set(&lintotestlaw.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&lintotestlaw.dst_format, AST_FORMAT_TESTLAW, 0);
+
+	ast_format_set(&ulawtolin.src_format, AST_FORMAT_ULAW, 0);
+	ast_format_set(&ulawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
+
+	ast_format_set(&testlawtolin.src_format, AST_FORMAT_TESTLAW, 0);
+	ast_format_set(&testlawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
+
 	res = ast_register_translator(&ulawtolin);
 	if (!res) {
 		res = ast_register_translator(&lintoulaw);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_alaw.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_alaw.h?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_alaw.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_alaw.h Wed Jan 12 18:27:31 2011
@@ -24,7 +24,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_ALAW,
 		.datalen = sizeof(ex_alaw),
 		.samples = ARRAY_LEN(ex_alaw),
 		.mallocd = 0,
@@ -32,6 +31,6 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_alaw,
 	};
-
+	ast_format_set(&f.subclass.format, AST_FORMAT_ALAW, 0);
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_ulaw.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_ulaw.h?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_ulaw.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_ulaw.h Wed Jan 12 18:27:31 2011
@@ -24,7 +24,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_ULAW,
 		.datalen = sizeof(ex_ulaw),
 		.samples = ARRAY_LEN(ex_ulaw),
 		.mallocd = 0,
@@ -33,5 +32,6 @@
 		.data.ptr = ex_ulaw,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_ULAW, 0);
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/slin.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/slin.h?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/slin.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/slin.h Wed Jan 12 18:27:31 2011
@@ -62,7 +62,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_SLINEAR,
 		.datalen = sizeof(ex_slin8) * 2,
 		.samples = ARRAY_LEN(ex_slin8),
 		.mallocd = 0,
@@ -71,6 +70,7 @@
 		.data.ptr = ex_slin8,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_SLINEAR, 0);
 	return &f;
 }
 
@@ -78,7 +78,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_SLINEAR16,
 		.datalen = sizeof(ex_slin16) * 2,
 		.samples = ARRAY_LEN(ex_slin16),
 		.mallocd = 0,
@@ -87,5 +86,6 @@
 		.data.ptr = ex_slin16,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_SLINEAR16, 0);
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/channel.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/channel.c Wed Jan 12 18:27:31 2011
@@ -7439,7 +7439,7 @@
 	ast_debug(1, "Bridge stops bridging channels %s and %s\n", c0->name, c1->name);
 
 	ast_cap_destroy(o0nativeformats);
-	ast_cap_destroy(o0nativeformats);
+	ast_cap_destroy(o1nativeformats);
 	return res;
 }
 

Modified: team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format_cap.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format_cap.c Wed Jan 12 18:27:31 2011
@@ -92,7 +92,7 @@
 {
 	struct ast_format *fnew;
 
-	if (!format) {
+	if (!format || !format->id) {
 		return;
 	}
 	if (!(fnew = ao2_alloc(sizeof(struct ast_format), NULL))) {
@@ -133,6 +133,10 @@
 {
 	struct ast_format tmp_fmt;
 	struct ast_cap *tmp_cap = (struct ast_cap *) src;
+
+	if (!src) {
+		return;
+	}
 	/* for every format in src that is not in dst, add that
 	 * format to dst. */
 	ast_cap_iter_start(tmp_cap);

Modified: team/dvossel/fixtheworld_phase1_step3/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/frame.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/frame.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/frame.c Wed Jan 12 18:27:31 2011
@@ -1004,6 +1004,7 @@
 				ast_log(LOG_WARNING, "Bad packetization value for codec %s\n", this);
 			}
 		}
+/* XXX todohere, all the 'all' case back. if this is still here for the review, say something*/
 		if (!ast_getformatbyname(this, &format)) {
 			ast_log(LOG_WARNING, "Cannot %s unknown format '%s'\n", allowing ? "allow" : "disallow", this);
 			errors++;

Modified: team/dvossel/fixtheworld_phase1_step3/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/translate.c?view=diff&rev=301727&r1=301726&r2=301727
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/translate.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/translate.c Wed Jan 12 18:27:31 2011
@@ -259,7 +259,7 @@
  */
 static struct translator_path *matrix_get(int x, int y)
 {
-	if (!(x > 0 && y > 0)) {
+	if (!(x >= 0 && y >= 0)) {
 		return NULL;
 	}
 	return __matrix[x] + y;




More information about the asterisk-commits mailing list