]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Dec 2007 18:13:07 +0000 (18:13 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 10 Dec 2007 18:13:07 +0000 (18:13 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6600 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_dptools/mod_dptools.c
src/switch_ivr_async.c

index 1102d6046e17bc52eb5766f455f59ab16b147efc..b79218f9c54b706704bcee8da82c3be8c7c38ef4 100644 (file)
@@ -1201,7 +1201,7 @@ SWITCH_STANDARD_APP(displace_session_function)
        if (data && (lbuf = switch_core_session_strdup(session, data))
                && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
                path = argv[0];
-               for(x = 0; x < argc; x++) {
+               for(x = 1; x < argc; x++) {
                        if (strchr(argv[x], '+')) {
                                limit = atoi(argv[x]);
                        } else if (!switch_strlen_zero(argv[x])) {
index 7a4e8807afe11e7ee46a0cfb2bab4934706a6638..826468831b8a48e392cc907786f5ab06350535cf 100644 (file)
@@ -131,6 +131,7 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data,
                if (dh) {
                        switch_frame_t *frame = NULL;
                        switch_size_t len;
+                       switch_status_t st;
 
                        frame = switch_core_media_bug_get_write_replace_frame(bug);
                        len = frame->samples;
@@ -139,8 +140,8 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data,
                                int16_t buf[1024];
                                int16_t *fp = frame->data;
                                uint32_t x;
-                               
-                               switch_core_file_read(&dh->fh, buf, &len);
+
+                               st = switch_core_file_read(&dh->fh, buf, &len);
                                
                                for(x = 0; x < (uint32_t) len; x++) {
                                        int32_t mixed = fp[x] + buf[x];
@@ -148,10 +149,15 @@ static switch_bool_t displace_callback(switch_media_bug_t *bug, void *user_data,
                                        fp[x] = (int16_t) mixed;
                                }
                        } else {
-                               switch_core_file_read(&dh->fh, frame->data, &len);
+                               st = switch_core_file_read(&dh->fh, frame->data, &len);
                                frame->samples = (uint32_t) len;
                                frame->datalen = frame->samples * 2;
                        }
+
+                       if (st != SWITCH_STATUS_SUCCESS || len == 0) {
+                               return SWITCH_FALSE;
+                       }
+
                        switch_core_media_bug_set_write_replace_frame(bug, frame);
                }
                break;