]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix all the bugs introduced by recent chainsaw massacre
authorMichael Jerris <mike@jerris.com>
Wed, 12 Apr 2006 20:48:47 +0000 (20:48 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 12 Apr 2006 20:48:47 +0000 (20:48 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1132 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/srtp/crypto/Makefile
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/switch_rtp.c

index fe5ae96f33eed5f2c429e1f0788b45688dc020e3..d7ac61fb14178556037e698f713877281f310a70 100644 (file)
@@ -12,7 +12,7 @@ CC    = gcc
 INCDIR = -Iinclude -I$(srcdir)/include
 DEFS   = -DHAVE_CONFIG_H
 CPPFLAGS= 
-CFLAGS = -fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops
+CFLAGS = -Wall -O4 -fexpensive-optimizations -funroll-loops
 LIBS   = 
 LDFLAGS        =  -L.
 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS)
index fb9fdc65dbcca87db63d021ad207207ce5022e2f..03a2459d6e1dba7ab15ce33ebd415a130e8004c5 100644 (file)
@@ -349,6 +349,28 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
        switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
        switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
 
+       if (!tech_pvt->rtp_session) {
+               const char *err;
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
+
+               if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
+                                                                                                        tech_pvt->local_port,
+                                                                                                        tech_pvt->remote_ip,
+                                                                                                        tech_pvt->remote_port,
+                                                                                                        tech_pvt->codec_num,
+                                                                                                        tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
+                                                                                                        tech_pvt->read_codec.implementation->microseconds_per_frame,
+                                                                                                        0,
+                                                                                                        NULL,
+                                                                                                        &err, switch_core_session_get_pool(tech_pvt->session)))) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
+                       switch_channel_hangup(channel);
+                       return NULL;
+               }
+               switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user);
+       }
+
+
        //printf("WAIT %s %d\n", switch_channel_get_name(channel), switch_test_flag(tech_pvt, TFLAG_OUTBOUND));
 
        if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@@ -1283,30 +1305,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
                                                
                                                tech_pvt->cand_id = ldl_session_candidates(dlsession, cand, 1);
                                                tech_pvt->desc_id = ldl_session_describe(dlsession, payloads, 1, LDL_DESCRIPTION_ACCEPT);
-
-
-                                               if (!tech_pvt->rtp_session) {
-                                                       const char *err;
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
-
-                                                       if (!(tech_pvt->rtp_session = switch_rtp_new(profile->ip,
-                                                                                                                                                tech_pvt->local_port,
-                                                                                                                                                tech_pvt->remote_ip,
-                                                                                                                                                tech_pvt->remote_port,
-                                                                                                                                                tech_pvt->codec_num,
-                                                                                                                                                tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
-                                                                                                                                                tech_pvt->read_codec.implementation->microseconds_per_frame,
-                                                                                                                                                0,
-                                                                                                                                                NULL,
-                                                                                                                                                &err, switch_core_session_get_pool(tech_pvt->session)))) {
-                                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
-                                                               switch_channel_hangup(channel);
-                                                               return LDL_STATUS_FALSE;
-                                                       }
-                                                       switch_set_flag(tech_pvt, TFLAG_RTP_READY);
-                                                       switch_rtp_activate_ice(tech_pvt->rtp_session, tech_pvt->remote_user, tech_pvt->local_user);
-                                               }
-                                               
+                                               switch_set_flag(tech_pvt, TFLAG_RTP_READY);
                                                return LDL_STATUS_SUCCESS;
                                        }
                                }
index 3cc0d9366c84a461d1d3a6cf07c8c2b399d1a9cd..e94a789db7c3878ad7beeaf0bdd896b4c9fcfa4a 100644 (file)
@@ -544,7 +544,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *dat
 
        int bytes = rtp_common_read(rtp_session, data, payload_type, flags);
        
-       if (bytes <= 0) {
+       if (bytes < 0) {
                *datalen = 0;
                return SWITCH_STATUS_GENERR;
        }
@@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session,
        int bytes = rtp_common_read(rtp_session, data, payload_type, flags);
        *data = rtp_session->recv_msg.body;
 
-       if (bytes <= 0) {
+       if (bytes < 0) {
                *datalen = 0;
                return SWITCH_STATUS_GENERR;
        }