]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
extra protection against unruly practice
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 May 2008 20:58:25 +0000 (20:58 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 May 2008 20:58:25 +0000 (20:58 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8314 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_core_io.c

index 212033ffd5da888064c3151131e57f3b1927bdab..82ab309bfb28905f1948a9fb9ebfbc84846472aa 100644 (file)
@@ -103,8 +103,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        switch_status_t status;
        int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
        unsigned int flag = 0;
+
   top:
 
+       if (!(session->read_codec && session->read_codec->implementation)) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
+               return SWITCH_STATUS_FALSE;
+       }
+
        if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
                *frame = NULL;
                return SWITCH_STATUS_FALSE;
@@ -502,6 +508,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
        }
 
        if (!(session->write_codec && session->write_codec->implementation)) {
+               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;
        }