]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
authorBrian West <brian@freeswitch.org>
Sat, 20 Jun 2009 03:39:54 +0000 (03:39 +0000)
committerBrian West <brian@freeswitch.org>
Sat, 20 Jun 2009 03:39:54 +0000 (03:39 +0000)
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@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@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

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
libs/unimrcp/libs/mpf/src/mpf_context.c

index ceaec016ce93cc1384550a8673f181d4e9b964c7..cbe536959d1158220a66c3bce8ad8d1f0a170f49 100644 (file)
@@ -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 @@ 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; 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 @@ static apt_bool_t l16_decode(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; i<frame_in->size; ) {
+       for(i=0; i<samples; i++) {
                buf_out[i] = ntohs(buf_in[i]);
-               i += sizeof(short);
        }
 
        return TRUE;
index 2f261484a58d76d1226ffaa650f0445e3d302132..0b8bc2ed17c4a6692f0df5f03ee7442a034a9299 100644 (file)
@@ -208,12 +208,12 @@ static mpf_object_t* mpf_context_connection_create(mpf_context_t *context, mpf_t
                                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;