]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
playfile fixes for startpos from Matt Klein.
authorMichael Jerris <mike@jerris.com>
Wed, 29 Nov 2006 20:07:13 +0000 (20:07 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 29 Nov 2006 20:07:13 +0000 (20:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3487 d0543943-73ff-0310-b7d9-9358b9ac24b2

AUTHORS
src/switch_ivr.c

diff --git a/AUTHORS b/AUTHORS
index 859b0e5b2af9b09eacd218db5b07ba6b21d29288..840d8f30bd33879a47a6901d3bcc1dcfdea76418 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -31,7 +31,7 @@ that much better:
  Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks.\r
  Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups.\r
  Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements.\r
-\r
+ Matt Klein <mklein@nmedia.net>\r
 \r
 A big THANK YOU goes to:\r
 \r
index 986f37ae8036bb8c3dd5d40e302a07ded493bbdb..93ce359c8bf18a24c51e1d7b5e6ae3be0cbd2ebb 100644 (file)
@@ -26,6 +26,7 @@
  * Anthony Minessale II <anthmct@yahoo.com>
  * Paul D. Tinsley <pdt at jackhammer.org>
  * Neal Horman <neal at wanlink dot com>
+ * Matt Klein <mklein@nmedia.net>
  *
  * switch_ivr_api.c -- IVR Library
  *
@@ -956,7 +957,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
        switch_channel_t *channel;
        int16_t abuf[FILE_STARTSAMPLES];
        char dtmf[128];
-       uint32_t interval = 0, samples = 0, framelen;
+       uint32_t interval = 0, samples = 0, framelen, sample_start = 0;
        uint32_t ilen = 0;
        switch_size_t olen = 0;
        switch_frame_t write_frame = {0};
@@ -974,6 +975,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
        uint8_t asis = 0;
        char *ext;
        
+       if (fh->samples > 0) {
+               sample_start = fh->samples;
+               fh->samples = 0;
+       }
+
        if (file) {
                if ((ext = strrchr(file, '.'))) {
                        ext++;
@@ -1009,9 +1015,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
        write_frame.data = abuf;
        write_frame.buflen = sizeof(abuf);
 
-    if (fh->samples) {
+    if (sample_start > 0) {
         uint32_t pos = 0;
-        switch_core_file_seek(fh, &pos, fh->samples, SEEK_CUR);
+        switch_core_file_seek(fh, &pos, sample_start, SEEK_CUR);
     }
        
        if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) {