From c57128abcef14d95196b9f9663d04e1a6744bbc7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Sat, 20 Jun 2009 03:39:54 +0000 Subject: [PATCH] Author: achaloyan Date: Fri Jun 19 18:11:47 2009 +0000 Fixed L16 encode/decode svn-id: https://unimrcp.googlecode.com/svn/trunk@995 Author: achaloyan 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 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 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13880 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/unimrcp/libs/mpf/src/mpf_codec_linear.c | 10 ++++++---- libs/unimrcp/libs/mpf/src/mpf_context.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c b/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c index ceaec016ce..cbe536959d 100644 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c +++ b/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c @@ -14,6 +14,8 @@ * limitations under the License. */ +#define APR_WANT_BYTEFUNC +#include #include "mpf_codec.h" /* linear 16-bit PCM (host horder) */ @@ -40,12 +42,12 @@ static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_ 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; isize; ) { + for(i=0; ibuffer; short *buf_out = frame_out->buffer; + apr_size_t samples = frame_in->size / sizeof(short); frame_out->size = frame_in->size; - for(i=0; isize; ) { + for(i=0; ipool); } 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;