fix all the bugs introduced by recent chainsaw massacre

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1132 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-04-12 20:48:47 +00:00
parent 4959cbff2b
commit d91f8ef358
3 changed files with 26 additions and 27 deletions

View 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)

View 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;
}
}

View 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;
}