quintodrome/core
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
..
agents feat(deezer): Add artist bio, top tracks, related artists and language support (#4720) 2025-11-21 15:09:24 -05:00
artwork fix(server): prioritize artist base image filenames over numeric suffixes and add tests for sorting 2025-11-14 13:15:50 -05:00
auth fix: retry insights collection when no admin user available (#4746) 2025-11-28 19:38:28 -05:00
external fix(server): ensure that similar artists retrieved from provider are no more than limit (#4267) 2025-06-29 12:19:29 -04:00
ffmpeg feat: add configurable transcoding cancellation (#4411) 2025-12-01 17:33:53 -05:00
lyrics fix: handle UTF BOM in lyrics and playlist files (#4637) 2025-10-31 09:07:23 -04:00
metrics fix(insights): add missing filesystem types to fsTypeMap 2025-11-30 11:26:59 -05:00
playback test: fix mpv tests on systems without /bin/bash installed - 4301 (#4302) 2025-07-02 21:55:55 -04:00
scrobbler test: remove racy buffer length assertion in scrobbler test 2025-11-30 21:59:11 -05:00
storage fix: improve URL path handling in local storage for special characters (#4378) 2025-07-23 20:46:47 -04:00
archiver.go feat(server): add M3U file to downloaded playlist 2025-05-27 20:13:37 -04:00
archiver_test.go feat(server): add M3U file to downloaded playlist 2025-05-27 20:13:37 -04:00
common.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
common_test.go test: add tests for userName and AbsolutePath in core/common.go 2025-04-18 11:53:47 -04:00
core_suite_test.go Rename log.LevelCritical to log.LevelFatal 2022-12-21 14:53:36 -05:00
inspect.go feat(bfr): Big Refactor: new scanner, lots of new fields and tags, improvements and DB schema changes (#2709) 2025-02-19 20:35:17 -05:00
library.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
library_test.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
maintenance.go fix(scanner): specify exact table to use for missing mediafile filter (#4689) 2025-11-16 12:54:28 -05:00
maintenance_test.go feat(scanner): implement selective folder scanning and file system watcher improvements (#4674) 2025-11-14 22:15:43 -05:00
media_streamer.go feat: add configurable transcoding cancellation (#4411) 2025-12-01 17:33:53 -05:00
media_streamer_Internal_test.go fix: forcing transcoding when client does not specify transcoding options (#3455) 2024-11-05 20:39:05 -05:00
media_streamer_test.go Add support for timeOffset in /stream endpoint 2023-12-02 13:10:36 -05:00
mock_library_service.go feat: Multi-library support (#4181) 2025-07-18 18:41:12 -04:00
players.go feat(server): group Subsonic config options together 2025-03-05 12:29:30 -08:00
players_test.go Use userId in player, other fixes (#3182) 2024-08-03 13:37:21 -04:00
playlists.go fix: handle UTF BOM in lyrics and playlist files (#4637) 2025-10-31 09:07:23 -04:00
playlists_test.go fix: handle UTF BOM in lyrics and playlist files (#4637) 2025-10-31 09:07:23 -04:00
share.go refactor: extract TruncateRunes function for safe string truncation with suffix 2025-11-06 14:27:38 -05:00
share_test.go refactor: extract TruncateRunes function for safe string truncation with suffix 2025-11-06 14:27:38 -05:00
wire_providers.go fix: album statistics not updating after deleting missing files (#4668) 2025-11-08 20:11:00 -05:00