avoiding racing cpu (part 2)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5446 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-06-23 03:26:12 +00:00
parent 0f6767a9e4
commit 24d64a618b
2 changed files with 13 additions and 15 deletions

View File

@ -21,12 +21,12 @@ print "Call: $data->{'caller-channel-name'} $data->{'unique-id'}\n";
$o = $fs->call_command("answer"); $o = $fs->call_command("answer");
#to turn on events when in async mode #to turn on events when in async mode
#$o = $fs->raw_command("myevents"); $o = $fs->raw_command("myevents");
$o = $fs->call_command("playback", "/ram/swimp.raw"); $o = $fs->call_command("playback", "/ram/swimp.raw");
$o = $fs->call_command("hangup"); $o = $fs->call_command("hangup");
#comment exit in async mode #comment exit in async mode
exit; #exit;
while(my $r = $fs->readhash(undef)) { while(my $r = $fs->readhash(undef)) {
if ($r->{socketerror}) { if ($r->{socketerror}) {

View File

@ -964,12 +964,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (status == SWITCH_STATUS_BREAK || bytes == 0) { if (status == SWITCH_STATUS_BREAK || bytes == 0) {
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DATAWAIT)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DATAWAIT)) {
if (rtp_session->ms_per_packet) { goto do_continue;
switch_yield((rtp_session->ms_per_packet / 1000) * 750);
} else {
switch_yield(1000);
}
continue;
} }
return 0; return 0;
} }
@ -1005,12 +1000,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (bytes && rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) { if (bytes && rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) {
if (rtp_session->ms_per_packet) { goto do_continue;
switch_yield((rtp_session->ms_per_packet / 1000) * 750);
} else {
switch_yield(1000);
}
continue;
} }
@ -1059,11 +1049,19 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
} }
} }
continue; goto do_continue;
} }
break; break;
do_continue:
if (rtp_session->ms_per_packet) {
switch_yield((rtp_session->ms_per_packet / 1000) * 750);
} else {
switch_yield(1000);
}
} }
*payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt; *payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;