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;
}
+ 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;