Bug 258381 - multimedia/libx264: This library inappropriately lowered the scheduling priority of the process using it
Summary: multimedia/libx264: This library inappropriately lowered the scheduling prior...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kubilay Kocak
Keywords: patch
Depends on:
Reported: 2021-09-09 05:45 UTC by WHR
Modified: 2021-09-09 05:53 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (koobs)

multimedia/x264/files/patch-common-osdep.h (777 bytes, text/plain)
2021-09-09 05:45 UTC, WHR
no flags Details
multimedia/x264/files/patch-common-osdep.h (675 bytes, patch)
2021-09-09 05:53 UTC, WHR
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description WHR 2021-09-09 05:45:04 UTC
Created attachment 227779 [details]

This library contains a logic that will attempting to lower the scheduling priority of the encoding thread, if multi-threading is enabled. However it is flawed as it will lower the priority of the entire process (by calling nice(3)), not only that specific thread; in fact in will lower the process scheduling priority every time when a encoding thread is created, the priority of whole process will be set to the lowest (nice=20) as a result.
This behavior is highly undesirable because it may result in losing real-time proformance of other threads of the library consumer, such as ffmpeg(1); libx264, as a library, shouldn't change the process priority, affecting the entire process of any program that may using this library.
Another issue is that under some scenarios, lowering the scheduling priority of encoding threads isn't preferable at all, because the video source or target could be a live stream, thus requiring real-time proformance to encode it.
A patch is attached that disables this behavior.
Comment 1 WHR 2021-09-09 05:53:51 UTC
Created attachment 227780 [details]

Clean up parent directory names in the diff file.