[Bug 258381] multimedia/libx264: This library inappropriately lowered the scheduling priority of the process using it

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 09 Sep 2021 05:45:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258381

            Bug ID: 258381
           Summary: multimedia/libx264: This library inappropriately
                    lowered the scheduling priority of the process using
                    it
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: koobs@FreeBSD.org
          Reporter: msl0000023508@gmail.com
          Assignee: koobs@FreeBSD.org
             Flags: maintainer-feedback?(koobs@FreeBSD.org)
 Attachment #227779 text/plain
         mime type:

Created attachment 227779
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=227779&action=edit
multimedia/x264/files/patch-common-osdep.h

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.