This commit is contained in:
Anthony Minessale 2014-06-24 15:42:07 -05:00
parent 1a58f05891
commit c71f89a39b
1 changed files with 19 additions and 0 deletions

View File

@ -670,6 +670,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
context->prebuf = handle->prebuf;
launch_read_stream_thread(context);
switch_cond_next();
} else {
handle->seekable = 1;
@ -681,8 +682,26 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
}
if (handle->handler) {
int sanity = 1000;
while(--sanity > 0 && !switch_buffer_inuse(context->audio_buffer)) {
switch_yield(20000);
}
if (!sanity) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s (data stream timeout)\n", path);
goto error;
}
}
mpg123_getformat(context->mh, &rate, &channels, &encoding);
if (!channels || !rate) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s (invalid rate or channel count)\n", path);
goto error;
}
handle->channels = channels;
handle->samplerate = rate;