FS-7173 #resolve #comment please verify fix in master
This commit is contained in:
parent
8fc19a6037
commit
b74448462d
|
@ -174,8 +174,6 @@ struct switch_core_session {
|
|||
uint32_t soft_lock;
|
||||
switch_ivr_dmachine_t *dmachine[2];
|
||||
plc_state_t *plc;
|
||||
uint8_t recur_buffer[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
switch_size_t recur_buffer_len;
|
||||
|
||||
switch_media_handle_t *media_handle;
|
||||
uint32_t decoder_errors;
|
||||
|
|
|
@ -372,7 +372,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
|||
}
|
||||
|
||||
frame->datalen = (uint32_t)bytes;
|
||||
frame->samples = (uint32_t)(bytes / sizeof(int16_t));
|
||||
frame->samples = (uint32_t)(bytes / sizeof(int16_t) / read_impl.number_of_channels);
|
||||
frame->rate = read_impl.actual_samples_per_second;
|
||||
frame->codec = NULL;
|
||||
|
||||
|
@ -380,22 +380,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
|||
frame->datalen *= 2;
|
||||
frame->channels = 2;
|
||||
} else {
|
||||
frame->channels = 1;
|
||||
}
|
||||
|
||||
memcpy(bug->session->recur_buffer, frame->data, frame->datalen);
|
||||
bug->session->recur_buffer_len = frame->datalen;
|
||||
|
||||
if (has_read) {
|
||||
switch_mutex_lock(bug->read_mutex);
|
||||
do_read = switch_buffer_inuse(bug->raw_read_buffer);
|
||||
switch_mutex_unlock(bug->read_mutex);
|
||||
}
|
||||
|
||||
if (has_write) {
|
||||
switch_mutex_lock(bug->write_mutex);
|
||||
do_write = switch_buffer_inuse(bug->raw_write_buffer);
|
||||
switch_mutex_unlock(bug->write_mutex);
|
||||
frame->channels = read_impl.number_of_channels;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -589,11 +574,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
|
|||
|
||||
if (orig_session->bugs) {
|
||||
switch_channel_t *new_channel = switch_core_session_get_channel(new_session);
|
||||
const char *save = switch_channel_get_variable(new_channel, "record_append");
|
||||
switch_channel_t *orig_channel = switch_core_session_get_channel(orig_session);
|
||||
const char *save_append = switch_channel_get_variable(new_channel, "record_append");
|
||||
const char *save_stereo = switch_channel_get_variable(new_channel, "record_stereo");
|
||||
const char *orig_stereo = switch_channel_get_variable(orig_channel, "record_stereo");
|
||||
const char *new_stereo = orig_stereo;
|
||||
|
||||
switch_thread_rwlock_wrlock(orig_session->bug_rwlock);
|
||||
|
||||
switch_channel_set_variable(new_channel, "record_append", "true");
|
||||
switch_channel_set_variable(new_channel, "record_stereo", new_stereo);
|
||||
|
||||
for (bp = orig_session->bugs; bp; bp = bp->next) {
|
||||
if (!strcmp(bp->function, "session_record")) {
|
||||
|
@ -614,7 +604,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch
|
|||
switch_ivr_record_session(new_session, list[i], stop_times[i], NULL);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(new_channel, "record_append", save);
|
||||
switch_channel_set_variable(new_channel, "record_append", save_append);
|
||||
switch_channel_set_variable(new_channel, "record_stereo", save_stereo);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1122,7 +1122,7 @@ static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *
|
|||
struct record_helper *rh;
|
||||
switch_size_t bsize = SWITCH_RECOMMENDED_BUFFER_SIZE, samples = 0, inuse = 0;
|
||||
unsigned char *data = switch_core_session_alloc(session, bsize);
|
||||
int channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : 1;
|
||||
int channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : rh->read_impl.number_of_channels;
|
||||
|
||||
if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
|
||||
return NULL;
|
||||
|
@ -2125,16 +2125,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
|||
flags |= SMBF_READ_STREAM;
|
||||
}
|
||||
|
||||
if ((p = switch_channel_get_variable(channel, "RECORD_STEREO")) && switch_true(p)) {
|
||||
flags |= SMBF_STEREO;
|
||||
flags &= ~SMBF_STEREO_SWAP;
|
||||
channels = 2;
|
||||
}
|
||||
if (channels == 1) { /* if leg is already stereo this feature is not available */
|
||||
if ((p = switch_channel_get_variable(channel, "RECORD_STEREO")) && switch_true(p)) {
|
||||
flags |= SMBF_STEREO;
|
||||
flags &= ~SMBF_STEREO_SWAP;
|
||||
channels = 2;
|
||||
}
|
||||
|
||||
if ((p = switch_channel_get_variable(channel, "RECORD_STEREO_SWAP")) && switch_true(p)) {
|
||||
flags |= SMBF_STEREO;
|
||||
flags |= SMBF_STEREO_SWAP;
|
||||
channels = 2;
|
||||
if ((p = switch_channel_get_variable(channel, "RECORD_STEREO_SWAP")) && switch_true(p)) {
|
||||
flags |= SMBF_STEREO;
|
||||
flags |= SMBF_STEREO_SWAP;
|
||||
channels = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if ((p = switch_channel_get_variable(channel, "RECORD_ANSWER_REQ")) && switch_true(p)) {
|
||||
|
@ -2230,6 +2232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
|||
|
||||
if ((ext = strrchr(file, '.'))) {
|
||||
ext++;
|
||||
|
||||
if (switch_core_file_open(fh, file, channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error opening %s\n", file);
|
||||
if (hangup_on_error) {
|
||||
|
|
Loading…
Reference in New Issue