[Freeswitch-svn] [commit] r4575 - in freeswitch/trunk/src: . include
Freeswitch SVN
anthm at freeswitch.org
Mon Mar 12 16:17:34 EDT 2007
Author: anthm
Date: Mon Mar 12 16:17:34 2007
New Revision: 4575
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_ivr.c
Log:
tweaks to file buffering
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Mon Mar 12 16:17:34 2007
@@ -730,7 +730,8 @@
SWITCH_FILE_DATA_DOUBLE = (1 << 6) - Read data in doubles
SWITCH_FILE_DATA_RAW = (1 << 7) - Read data as is
SWITCH_FILE_PAUSE = (1 << 8) - Pause
-SWITCH_FILE_NATIVE = (1 << 8) - File is in native format (no transcoding)
+SWITCH_FILE_NATIVE = (1 << 9) - File is in native format (no transcoding)
+SWITCH_FILE_SEEK = (1 << 10) - File has done a seek
</pre>
*/
typedef enum {
@@ -743,7 +744,8 @@
SWITCH_FILE_DATA_DOUBLE = (1 << 6),
SWITCH_FILE_DATA_RAW = (1 << 7),
SWITCH_FILE_PAUSE = (1 << 8),
- SWITCH_FILE_NATIVE = (1 << 9)
+ SWITCH_FILE_NATIVE = (1 << 9),
+ SWITCH_FILE_SEEK = (1 << 10)
} switch_file_flag_t;
typedef enum {
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Mar 12 16:17:34 2007
@@ -432,7 +432,8 @@
SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel)
{
assert(channel != NULL);
- return (channel->state > CS_RING && channel->state < CS_HANGUP && !switch_test_flag(channel, CF_TRANSFER)) ? 1 : 0;
+
+ return (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && !switch_test_flag(channel, CF_TRANSFER)) ? 1 : 0;
}
static const char *state_names[] = {
@@ -1059,7 +1060,7 @@
assert(channel != NULL);
- if (channel->state >= CS_HANGUP) {
+ if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -1093,7 +1094,7 @@
assert(channel != NULL);
- if (channel->state >= CS_HANGUP) {
+ if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -1127,7 +1128,7 @@
assert(channel != NULL);
- if (channel->state >= CS_HANGUP) {
+ if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -1169,7 +1170,7 @@
{
assert(channel != NULL);
- if (channel->state >= CS_HANGUP) {
+ if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Mon Mar 12 16:17:34 2007
@@ -1070,6 +1070,8 @@
int whence)
{
assert(fh != NULL);
+
+ switch_set_flag(fh, SWITCH_FILE_SEEK);
return fh->file_interface->file_seek(fh, cur_pos, samples, whence);
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Mon Mar 12 16:17:34 2007
@@ -1377,6 +1377,12 @@
switch_buffer_zero(fh->audio_buffer);
}
+ if (switch_test_flag(fh, SWITCH_FILE_SEEK)) {
+ /* file position has changed flush the buffer */
+ switch_buffer_zero(fh->audio_buffer);
+ switch_clear_flag(fh, SWITCH_FILE_SEEK);
+ }
+
if (!asis && fh->speed && do_speed) {
float factor = 0.25f * abs(fh->speed);
More information about the Freeswitch-svn
mailing list