]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
byte swap on l16 read codec
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 Aug 2008 19:12:38 +0000 (19:12 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 Aug 2008 19:12:38 +0000 (19:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9285 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_play_say.c

index 196b4b84fd586f0db460ae7a74c522950b958992..84bae11a44e966ae88da5715fb0549a59df223fc 100644 (file)
@@ -731,6 +731,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
        const char *alt = NULL;
        int eof = 0;
        switch_size_t bread = 0;
+       int l16 = 0;
 
        switch_channel_pre_answer(channel);
 
@@ -739,6 +740,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
 
        read_codec = switch_core_session_get_read_codec(session);
 
+       if (!strcasecmp(read_codec->implementation->iananame, "l16")) {
+               l16++;
+       }
+
        if (switch_strlen_zero(file) || !read_codec) {
                status = SWITCH_STATUS_FALSE;
                goto end;
@@ -1143,12 +1148,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                        write_frame.timestamp = timer.samplecount;
                }
 #ifndef WIN32
-#if 0 // don't seem to need it, maybe only on mac?
-//#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
-               if (!asis) {
+               //#if SWITCH_BYTE_ORDER == __BIG_ENDIAN
+               if (!asis && l16) {
                        switch_swap_linear(write_frame.data, (int) write_frame.datalen / 2);
                }
-#endif
+               //#endif
 #endif
                if (fh->vol) {
                        switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol);