]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
iax tweak
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Aug 2006 19:45:52 +0000 (19:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 7 Aug 2006 19:45:52 +0000 (19:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2234 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_iax/mod_iax.c

index 931c182ab4493031830e5d51f9e80c77ab10d619..358935011a55fbd88d772f71f1bd5de396b06552 100644 (file)
@@ -239,10 +239,9 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
                static const switch_codec_implementation_t *imp;
                for (imp = codecs[x]; imp; imp = imp->next) {
                        unsigned int codec = iana2ast(imp->ianacode);
-               
-                       if (io == IAX_QUERY) {
+                       if (io == IAX_QUERY && !(codec & local_cap)) {
                                iax_pref_codec_add(iax_session, codec);
-                       }
+                       }       
                        local_cap |= codec;
                }
        }
@@ -254,6 +253,7 @@ static switch_status_t iax_set_codec(struct private_object *tech_pvt, struct iax
        }
 
        leading = iana2ast(codecs[0]->ianacode);
+       interval = codecs[0]->microseconds_per_frame / 1000;
        if (io == IAX_QUERY) {
                chosen = leading;
                *format = chosen;
@@ -638,8 +638,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                        if (!tech_pvt->read_frame.datalen) {
                                continue;
                        }
-
                        *frame = &tech_pvt->read_frame;
+#ifdef BIGENDIAN
+                       if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+                               switch_swap_linear((*frame)->data, (int) (*frame)->datalen);
+                       }
+#endif
                        return SWITCH_STATUS_SUCCESS;
                }
 
@@ -674,7 +678,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
        if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
                return SWITCH_STATUS_FALSE;
        }
-#ifndef BIGENDIAN
+#ifdef BIGENDIAN
        if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
                switch_swap_linear(frame->data, (int) frame->datalen / 2);
        }