Skip to content

Fix transcode throttling not enabling on supported systems (caused by race condition) - #17906

Merged
crobibero merged 1 commit into
jellyfin:release-12.zfrom
SimonvBez:fix/p-key-support-detection
Sep 10, 2026
Merged

crobibero merged 1 commit into
jellyfin:release-12.zfrom
SimonvBez:fix/p-key-support-detection

Conversation

@SimonvBez

Copy link
Copy Markdown
Contributor

Changes

Made the CheckSupportedRuntimeKey() function way more race condition resistent without increasing the runtime, as well as making it less resource intensive (by making the dummy job realtime).
This fixes transcode throttling not getting enabled on supported systems that completed the old dummy job so fast that ffmpeg was not able to write its runtime key commands to the stdout.

Code assistance

Used ChatGPT to help understand what exactly all old ffmpeg arguments did.
NOT used for new code

Issues

Fixes #17905 (the issue also includes a root cause analysis)

@nyanmisaka nyanmisaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With -re, you can actually set :r=1 for nullsrc. Either way, it will take 5 seconds to complete.

@Shadowghost Shadowghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please retarget and rebase onto the release branch

@SimonvBez

Copy link
Copy Markdown
Contributor Author

With -re, you can actually set :r=1 for nullsrc.

True, though reducing the framerate to 1 will somewhat reduce the snappiness of how fast ffmpeg is able to respond to the stdin inputs. Still I'd consider the current ~40 frames generated over the previous 250000 a fairly nice bonus already. (at least on my system)
Should I add :r=1 as well?

Either way, it will take 5 seconds to complete.

It should take less than that, because I also added a q (quit) key command that will be done right after the ?.
5 seconds should be the absolute max in case something goes wrong and ffmpeg somehow is not able to handle the quit request.

@SimonvBez
SimonvBez changed the base branch from master to release-12.z September 9, 2026 15:06
@SimonvBez
SimonvBez requested review from a team and joshuaboniface as code owners September 9, 2026 15:06
@SimonvBez
SimonvBez force-pushed the fix/p-key-support-detection branch from 122e4b5 to ac08232 Compare September 9, 2026 15:08
@SimonvBez

Copy link
Copy Markdown
Contributor Author

Can you please retarget and rebase onto the release branch

Should be done now!

In case I should make any changes, is there a preference to use a new commit or amend+force the current one? Since the code change is fairly small (though with great impact for me!)

@theguymadmax theguymadmax added the stable backport Backport into the next stable release label Sep 9, 2026
@theguymadmax theguymadmax moved this from Todo to Approved in Jellyfin v12 Sep 9, 2026
@nyanmisaka

Copy link
Copy Markdown
Member

Should I add :r=1 as well?

The 25fps workload requirement from the past is no longer relevant. Therefore, setting nullsrc=s=1x1:r=1:d=5 might slightly reduce overhead.

It should take less than that, because I also added a q (quit) key command that will be done right after the ?. 5 seconds should be the absolute max in case something goes wrong and ffmpeg somehow is not able to handle the quit request.

Yes, it usually ends with q, and 5s is a safety threshold.

Comment thread MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs Outdated
The previous duration was too short on faster systems for ffmpeg to print its runtime keybinds
@SimonvBez
SimonvBez force-pushed the fix/p-key-support-detection branch from ac08232 to 35c3d7d Compare September 10, 2026 08:55
@sonarqubecloud

Copy link
Copy Markdown

@jellyfin-bot

Copy link
Copy Markdown
Contributor

Jellyfin API (v 12.0.0)


Result


No differences. Specifications are equivalent

@crobibero
crobibero merged commit b8b6e39 into jellyfin:release-12.z Sep 10, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in Jellyfin v12 Sep 10, 2026
joshuaboniface pushed a commit that referenced this pull request Sep 15, 2026
Fix transcode throttling not enabling on supported systems (caused by race condition)

Original-merge: b8b6e39

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Cody Robibero <cody@robibe.ro>
@crobibero crobibero removed the stable backport Backport into the next stable release label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Throttle Transcodes fails to enable due to faulty "P-key pause support" check

6 participants