]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 3 Oct 2008 18:24:26 +0000 (18:24 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 3 Oct 2008 18:24:26 +0000 (18:24 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9812 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core_io.c

index fc895850331f541294f247c98dac6d457f74e256..c481c8eabc08c8e99e466b3a5514342b34761d53 100644 (file)
@@ -514,8 +514,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
 
        switch_status_t status = SWITCH_STATUS_FALSE;
        switch_frame_t *enc_frame = NULL, *write_frame = frame;
-       unsigned int flag = 0, need_codec = 0, perfect = 0, do_bugs = 0, do_write = 0, do_resample = 0, ptime_mismatch = 0;
-
+       unsigned int flag = 0, need_codec = 0, perfect = 0, do_bugs = 0, do_write = 0, do_resample = 0, ptime_mismatch = 0, pass_cng = 0;
+       
        switch_assert(session != NULL);
        switch_assert(frame != NULL);
 
@@ -523,7 +523,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                return SWITCH_STATUS_FALSE;
        }
 
-       if (!(session->write_codec && session->write_codec->implementation)) {
+       if (switch_test_flag(frame, SFF_CNG)) {
+               if (switch_channel_test_flag(session->channel, CF_ACCEPT_CNG)) {
+                       pass_cng = 1;
+               }
+               return SWITCH_STATUS_SUCCESS;
+       }
+       
+       if (!(session->write_codec && session->write_codec->implementation) && !pass_cng) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no write codec.\n", switch_channel_get_name(session->channel));
                return SWITCH_STATUS_FALSE;
        }
@@ -532,18 +539,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
                return SWITCH_STATUS_SUCCESS;
        }
 
-       if (switch_test_flag(frame, SFF_PROXY_PACKET)) {
+       if (switch_test_flag(frame, SFF_PROXY_PACKET) || pass_cng) {
                /* Fast PASS! */
                return perform_write(session, frame, flag, stream_id);
        }
 
-       if (switch_test_flag(frame, SFF_CNG)) {
-               if (switch_channel_test_flag(session->channel, CF_ACCEPT_CNG)) {
-                       return perform_write(session, frame, flag, stream_id);
-               }
-               return SWITCH_STATUS_SUCCESS;
-       }
-
        switch_assert(frame->codec != NULL);
 
        if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {