]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11796: [mod_http_cache] Fixed file seek in mod_http_cache.c
authorNoah Mehl <noahmehl@tinyhomeconsultingllc.com>
Mon, 13 May 2019 17:56:17 +0000 (13:56 -0400)
committerNoah Mehl <noahmehl@tinyhomeconsultingllc.com>
Mon, 13 May 2019 17:56:17 +0000 (13:56 -0400)
Added missing http_cache_file_seek() and http_cache_file_seek file interface references.

src/mod/applications/mod_http_cache/mod_http_cache.c

index 21fa078ffab7a16b77a2d5190907a87a7361bfbe..e3f8d064930f720a571e43b8282bdcaeb7010caf 100644 (file)
@@ -1864,6 +1864,17 @@ static switch_status_t http_file_close(switch_file_handle_t *handle)
        return status;
 }
 
+static switch_status_t http_cache_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
+{
+    struct http_context *context = (struct http_context *)handle->private_info;
+
+    if (!handle->seekable) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n");
+        return SWITCH_STATUS_NOTIMPL;
+    }
+    return switch_core_file_seek(&context->fh, cur_sample, samples, whence);
+}
+
 static char *http_supported_formats[] = { "http", NULL };
 static char *https_supported_formats[] = { "https", NULL };
 static char *http_cache_supported_formats[] = { "http_cache", NULL };
@@ -1907,6 +1918,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
        file_interface->file_write = http_file_write;
        file_interface->file_read_video = http_file_read_video;
        file_interface->file_write_video = http_file_write_video;
+    file_interface->file_seek = http_cache_file_seek;
 
        if (gcache.enable_file_formats) {
                file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
@@ -1918,6 +1930,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
                file_interface->file_write = http_file_write;
                file_interface->file_read_video = http_file_read_video;
                file_interface->file_write_video = http_file_write_video;
+        file_interface->file_seek = http_cache_file_seek;
 
                file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
                file_interface->interface_name = modname;
@@ -1928,6 +1941,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
                file_interface->file_write = http_file_write;
                file_interface->file_read_video = http_file_read_video;
                file_interface->file_write_video = http_file_write_video;
+        file_interface->file_seek = http_cache_file_seek;
        }
 
        /* create the queue from configuration */