[Freeswitch-trunk] [commit] r13880 - freeswitch/trunk/libs/unimrcp/libs/mpf/src

FreeSWITCH SVN brian at freeswitch.org
Fri Jun 19 20:39:54 PDT 2009


Author: brian
Date: Fri Jun 19 22:39:54 2009
New Revision: 13880

Log:
Author: achaloyan <achaloyan at f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Fri Jun 19 18:11:47 2009 +0000

    Fixed L16 encode/decode
    
    svn-id: https://unimrcp.googlecode.com/svn/trunk@995

Author: achaloyan <achaloyan at f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Fri Jun 19 18:10:49 2009 +0000

    Make decision whether to set decoder before and encoder after the bridge based on codec vtable (even linear codec such as L16 has encoder and decoder)
    
    svn-id: https://unimrcp.googlecode.com/svn/trunk@994

Author: achaloyan <achaloyan at f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Fri Jun 19 17:24:00 2009 +0000

    Added missing #include for BYTEFUNC (fixed compilation undr gcc)
    
    svn-id: https://unimrcp.googlecode.com/svn/trunk@993



Modified:
   freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
   freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c

Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c	(original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c	Fri Jun 19 22:39:54 2009
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#define APR_WANT_BYTEFUNC
+#include <apr_want.h>
 #include "mpf_codec.h"
 
 /* linear 16-bit PCM (host horder) */
@@ -40,12 +42,12 @@
 	apr_uint32_t i;
 	const short *buf_in = frame_in->buffer;
 	short *buf_out = frame_out->buffer;
+	apr_size_t samples = frame_in->size / sizeof(short);
 
 	frame_out->size = frame_in->size;
 
-	for(i=0; i<frame_in->size; ) {
+	for(i=0; i<samples; i++) {
 		buf_out[i] = htons(buf_in[i]);
-		i += sizeof(short);
 	}
 
 	return TRUE;
@@ -56,12 +58,12 @@
 	apr_uint32_t i;
 	const short *buf_in = frame_in->buffer;
 	short *buf_out = frame_out->buffer;
+	apr_size_t samples = frame_in->size / sizeof(short);
 
 	frame_out->size = frame_in->size;
 
-	for(i=0; i<frame_in->size; ) {
+	for(i=0; i<samples; i++) {
 		buf_out[i] = ntohs(buf_in[i]);
-		i += sizeof(short);
 	}
 
 	return TRUE;

Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c
==============================================================================
--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c	(original)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c	Fri Jun 19 22:39:54 2009
@@ -208,12 +208,12 @@
 				object = mpf_null_bridge_create(source,sink,context->pool);
 			}
 			else {
-				if(rx_codec->attribs->bits_per_samples != BITS_PER_SAMPLE) {
+				if(rx_codec->vtable && rx_codec->vtable->decode) {
 					/* set decoder before bridge */
 					mpf_audio_stream_t *decoder = mpf_decoder_create(source,context->pool);
 					source = decoder;
 				}
-				if(tx_codec->attribs->bits_per_samples != BITS_PER_SAMPLE) {
+				if(tx_codec->vtable && tx_codec->vtable->encode) {
 					/* set encoder after bridge */
 					mpf_audio_stream_t *encoder = mpf_encoder_create(sink,context->pool);
 					sink = encoder;



More information about the Freeswitch-trunk mailing list