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])) {
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;
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];
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;