]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_httapi, mod_http_cache] pass through seek values tracked in handle on proxy...
authorAnthony Minessale <anthm@signalwire.com>
Fri, 22 May 2020 00:36:03 +0000 (00:36 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:12 +0000 (22:00 +0300)
src/mod/applications/mod_httapi/mod_httapi.c
src/mod/applications/mod_http_cache/mod_http_cache.c

index cc2c857a583d6b6b27d6ec7f21263d3b8dc34d00..86a05bb258eae75aa14c0e55b8e21576f185bdef 100644 (file)
@@ -2885,13 +2885,21 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
 static switch_status_t http_file_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence)
 {
        http_file_context_t *context = handle->private_info;
-
+       switch_status_t status;
+       
        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);
+       if ((status = switch_core_file_seek(&context->fh, cur_sample, samples, whence)) == SWITCH_STATUS_SUCCESS) {
+               handle->pos = context->fh.pos;
+               handle->offset_pos = context->fh.offset_pos;
+               handle->samples_in = context->fh.samples_in;
+               handle->samples_out = context->fh.samples_out;
+       }
+
+       return status;
 }
 
 static switch_status_t file_open(switch_file_handle_t *handle, const char *path, int is_https)
index dcf1d7bff5902bed92b635cd32a96ee5bf52c49c..3e6d1b0fa86a6da4f6ed8cadbac6f8e3be3bfdbc 100644 (file)
@@ -1936,13 +1936,22 @@ static switch_status_t http_file_close(switch_file_handle_t *handle)
 
 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;
+       struct http_context *context = (struct http_context *)handle->private_info;
+       switch_status_t status;
+       
+       if (!handle->seekable) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n");
+               return SWITCH_STATUS_NOTIMPL;
+       }
 
-    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);
+       if ((status = switch_core_file_seek(&context->fh, cur_sample, samples, whence)) == SWITCH_STATUS_SUCCESS) {
+               handle->pos = context->fh.pos;
+               handle->offset_pos = context->fh.offset_pos;
+               handle->samples_in = context->fh.samples_in;
+               handle->samples_out = context->fh.samples_out;
+       }
+
+       return status;
 }
 
 static char *http_supported_formats[] = { "http", NULL };