diff options
| author | 2025-01-01 16:04:59 -0500 | |
|---|---|---|
| committer | 2025-01-01 16:13:22 -0500 | |
| commit | 24b58a516e6bacfdf59aac422411c2f1fcf4ffb2 (patch) | |
| tree | 834284316a98f829362619eb2174022687df85ea /src/cache/handlers | |
| parent | 20003fd25404ee5fc4cd068fbc4fae1ad6f6ae99 (diff) | |
| download | camu-24b58a516e6bacfdf59aac422411c2f1fcf4ffb2.tar.gz camu-24b58a516e6bacfdf59aac422411c2f1fcf4ffb2.tar.bz2 camu-24b58a516e6bacfdf59aac422411c2f1fcf4ffb2.zip | |
Optimizations based on video loop performance
- Support nn_packet_stream direct mode
- Hook up FFmpeg hardware accelerated decoding
- Refactor VCR
- Reduce locking when returning packets to a packet pool
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/cache/handlers')
| -rw-r--r-- | src/cache/handlers/http.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/cache/handlers/http.c b/src/cache/handlers/http.c index 308633e..b5f2504 100644 --- a/src/cache/handlers/http.c +++ b/src/cache/handlers/http.c @@ -16,36 +16,41 @@ static bool handler_http_can_seek(struct cch_handler *handler) return false; } -static size_t http_callback(void *userdata, u8 op, u8 *buf, s64 int0) +static void http_callback(void *userdata, u8 op, u8 *buf, void *opaque) { struct cch_handler_http *http = (struct cch_handler_http *)userdata; - size_t ret = (size_t)int0; switch (op) { case NNWT_HTTP_READ: - al_assert_and_return(0); + al_assert(false); case NNWT_HTTP_WRITE: { + size_t n = *(size_t *)opaque; // If we got data before a Content-Length, assume the size is unknown. if (cch_entry_get_size(http->handler.entry) < 0) { cch_entry_set_size(http->handler.entry, 0); } - http->backing->write(http->backing, buf, http->pointer, &ret); - http->pointer += ret; + http->backing->write(http->backing, buf, http->pointer, &n); + http->pointer += n; + *(size_t *)opaque = n; cch_threaded_waits_evaluate(&http->handler, http->backing); break; } - case NNWT_HTTP_RESPONSE_CODE: - al_log_debug("cache_handler_http", "HTTP %ld.", int0); + case NNWT_HTTP_RESPONSE_CODE: { + long response_code = *(long *)opaque; + al_log_debug("cache_handler_http", "HTTP %ld.", response_code); break; + } case NNWT_HTTP_CONTENT_LENGTH: { - off_t content_length = (off_t)int0; - al_log_debug("cache_handler_http", "Content-Length: %lld.", content_length); - cch_entry_set_size(http->handler.entry, content_length); + curl_off_t length = *(curl_off_t *)opaque; + al_log_debug("cache_handler_http", "Content-Length: %lld.", length); + cch_entry_set_size(http->handler.entry, length); cch_threaded_waits_signal_any(&http->handler); break; } - case NNWT_HTTP_REDIRECT: - al_log_debug("cache_handler_http", "Redirect %ld.", int0); + case NNWT_HTTP_REDIRECT: { + long response_code = *(long *)opaque; + al_log_debug("cache_handler_http", "Redirect %ld.", response_code); break; + } case NNWT_HTTP_FINISHED: al_log_debug("cache_handler_http", "Transfer finished."); break; @@ -55,7 +60,6 @@ static size_t http_callback(void *userdata, u8 op, u8 *buf, s64 int0) default: break; } - return ret; } static void handler_http_maybe_spawn_worker(struct cch_handler *handler, size_t index) |