]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add interval to file handles for streams
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 2 Dec 2007 16:01:56 +0000 (16:01 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 2 Dec 2007 16:01:56 +0000 (16:01 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6473 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_module_interfaces.h
src/mod/formats/mod_local_stream/mod_local_stream.c
src/mod/formats/mod_shout/mod_shout.c

index 48f6a809c4805e1a8b5bf2f32543914edc982627..0c5262717ad185e3362706146855c9b41ca5416d 100644 (file)
@@ -279,6 +279,7 @@ struct switch_file_handle {
        /*! pre-buffer x bytes for streams */
        uint32_t prebuf;
        /*! private data for the format module to store handle specific info */
+       uint32_t interval;
        void *private_info;
        char *handler;
        int64_t pos;
index 82e723e82ea3d977faba0762e0fbd73ab275b014..45a25f8c6d506c78e738057eae2b5da178de43ad 100644 (file)
@@ -174,13 +174,14 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
        handle->seekable = 0;
        handle->speed = 0;
        handle->private_info = context;
+       handle->interval = source->interval;
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening Stream [%s] %dhz\n", path, handle->samplerate);
        
        switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
        if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
                return SWITCH_STATUS_MEMERR;
-       }       
+       }
        
        context->source = source;
 
index d38dc9733bc5f00005c2cd8a99dad47d95bfb73b..cfba8a22193724918d1693d7721c3f817d27425e 100644 (file)
@@ -1123,6 +1123,7 @@ void do_broadcast(switch_stream_handle_t *stream)
     uint8_t buf[1024];
     int rlen;
     int is_local = 0;
+    uint32_t interval = 20000;
 
     if (strstr(path_info + 7, "://")) {
         file = strdup(path_info + 7);
@@ -1171,14 +1172,17 @@ void do_broadcast(switch_stream_handle_t *stream)
                            path_info + 7);
 
 
-            
+    if (fh.interval) {
+        interval = fh.interval;
+    }
+
     for(;;) {
         switch_size_t samples = sizeof(buf) / 2;
 
         switch_core_file_read(&fh, buf, &samples);
 
         if (is_local) {
-            switch_yield(20000);
+            switch_yield(interval);
         }
 
         if (!samples) {