quintodrome/conf
Deluan Quintão 33d9ce6ecc
feat: add configurable transcoding cancellation (#4411)
* feat: add configurable transcoding cancellation

Implemented EnableTranscodingCancellation configuration option to control whether
FFmpeg transcoding processes can be interrupted when client requests are cancelled.
This addresses resource management issues on low-power hardware where transcoding
processes would accumulate and cause CPU spikes.

Key changes:
- Added EnableTranscodingCancellation bool to configuration (default: false)
- Added CLI flag --enabletranscodingcancellation and TOML/env support
- Modified FFmpeg package to always use exec.CommandContext for consistency
- Implemented conditional context handling in NewTranscodingCache function
- When enabled: uses request context directly (allows cancellation)
- When disabled: uses background context with request metadata preserved
- Added comprehensive tests for both FFmpeg and transcoding layers
- Maintained backward compatibility with existing behavior as default

The implementation follows proper layered architecture with policy decisions
at the media streaming layer and execution utilities remaining focused on
their core responsibilities.

Signed-off-by: Deluan <deluan@navidrome.org>

* test: refactor FFmpeg context cancellation tests for improved clarity and reliability

Signed-off-by: Deluan <deluan@navidrome.org>

* test: reset FFmpeg initialization

Signed-off-by: Deluan <deluan@navidrome.org>

* test: improve FFmpeg context cancellation tests for cross-platform compatibility

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-12-01 17:33:53 -05:00
..
buildtags build(netgo): make sure the project is always compiled with netgo build tag (#3428) 2024-10-26 13:28:23 -04:00
configtest Fix background images when BaseURL is specified 2022-11-29 14:48:05 -05:00
mime fix(ui): service worker does not load new version of ui (#3402) 2024-10-16 21:39:14 -04:00
testdata fix(config): enables quoted ; as values in ini files 2025-11-22 20:14:44 -05:00
configuration.go feat: add configurable transcoding cancellation (#4411) 2025-12-01 17:33:53 -05:00
configuration_test.go test: prevent environment variables from overriding config file values in tests 2025-11-29 11:45:07 -05:00
export_test.go feat(scanner): add Scanner.PurgeMissing configuration option (#4107) 2025-05-22 20:50:15 -04:00