FS-7654 regression on eavesdropping on channels playing a file because of channel count of 0 on write frame from stream_file

This commit is contained in:
Anthony Minessale 2015-07-22 00:29:36 -05:00
parent e2f17ea04a
commit 95d4f18e52
2 changed files with 4 additions and 2 deletions

View File

@ -1693,10 +1693,12 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
if (switch_buffer_inuse(ep->w_buffer) >= rframe->datalen) {
uint32_t bytes;
int channels = rframe->channels ? rframe->channels : 1;
switch_buffer_lock(ep->w_buffer);
bytes = (uint32_t) switch_buffer_read(ep->w_buffer, data, rframe->datalen);
rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2, rframe->channels) * 2 * rframe->channels;
rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2, channels) * 2 * channels;
rframe->samples = rframe->datalen / 2;
switch_buffer_unlock(ep->w_buffer);

View File

@ -1438,7 +1438,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
"Setup timer success %u bytes per %d ms! %d ch\n", len, interval, codec.implementation->number_of_channels);
}
write_frame.rate = fh->samplerate;
write_frame.channels = fh->channels;
if (timer_name) {
/* start a thread to absorb incoming audio */
switch_core_service_session(session);