Bug 258381

Summary: multimedia/libx264: This library inappropriately lowered the scheduling priority of the process using it
Product: Ports & Packages Reporter: WHR <msl0000023508>
Component: Individual Port(s)Assignee: Kubilay Kocak <koobs>
Status: New ---    
Severity: Affects Only Me CC: msl0000023508
Priority: --- Keywords: patch
Version: LatestFlags: bugzilla: maintainer-feedback? (koobs)
Hardware: Any   
OS: Any   
Description Flags
multimedia/x264/files/patch-common-osdep.h none

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.