</condition>
</extension>
+ <extension name="9192">
+ <condition field="destination_number" expression="^9192$">
+ <!-- Maintain Buffer of 128k of audio (default is 64k) -->
+ <action application="set" data="stream_prebuffer=131072"/>
+ <!-- Play a stream -->
+ <action application="playback" data="shout://mp3.ihets.org/wfyihd132"/>
+ </condition>
+ </extension>
+
+
<!-- Example extension for require auth per-call. -->
<extension name="9191">
<!-- Match the destination digits of 9191 -->
int speed;
/*! the handle's memory pool */
switch_memory_pool_t *memory_pool;
+ /*! pre-buffer x bytes for streams */
+ uint32_t prebuf;
/*! private data for the format module to store handle specific info */
void *private_info;
char *handler;
int samplerate;
uint8_t thread_running;
uint8_t shout_init;
+ uint32_t prebuf;
};
typedef struct shout_context shout_context_t;
error_check();
+ if (context->prebuf) {
+ buf_size = context->prebuf;
+ }
+
/* make sure we aren't over zealous by slowing down the stream when the buffer is too full */
for (;;) {
error_check();
switch_mutex_unlock(context->audio_mutex);
if (used < buf_size) {
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
break;
}
- switch_yield(1000000);
+ switch_yield(500000);
}
error_check();
InitMP3(&context->mp, OUTSCALE, context->samplerate);
if (handle->handler) {
context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
+ context->prebuf = handle->prebuf;
launch_read_stream_thread(context);
} else {
if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) !=
char *ext;
char *prefix;
char *timer_name;
+ char *prebuf;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
prefix = switch_channel_get_variable(channel, "sound_prefix");
timer_name = switch_channel_get_variable(channel, "timer_name");
+
if (!file) {
return SWITCH_STATUS_FALSE;
}
fh->samples = 0;
}
+ if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
+ int maybe = atoi(prebuf);
+ if (maybe > 0) {
+ fh->prebuf = maybe;
+ }
+ }
+
+
+
if (switch_core_file_open(fh,
file,
read_codec->implementation->number_of_channels,