Move multiplication to when its passed to the encoder, so that bitrate
is kept in kbps. Changed for both for H264 and HEVC. Other encoders
(x264 and NVENC) already display bitrate in kbps in the log,
so it makes sense to mimic this with AMF. It's difficult to tell the
exact bitrate with bps.
This goes back to a slightly older variant of the
SubmitInput/QueryOutput handling that doesn't use AMF's timeout
property. Older devices do not like it when you change the query timeout
on the fly and will lock up. So instead, wait one millisecond when the
AMF input is full, which appears to fix the issue according to testers.
Also adds a loop timeout in case it goes in an infinite loop (which it
shouldn't anymore, but still)
Big thanks to Flaeri for testing the old code, and Yukari for patiently
testing a whole bunch of builds.
All this does is it uses the same exact code AMD uses with their own
example FFmpeg muxer code. Although instead of adding to the PTS, it
subtracts from the DTS.
The memory leak was introduced by a commit ba68eda59 to use
av_packet_alloc because av_init_packet got deprecated.
Also removes a boolean flag `new_packet` and use the pointer `packet`,
which is introduced by ba68eda59, to indicate there is a new packet.
Co-authored-by: Norihiro Kamae <norihiro@nagater.net>
Parentheses are needed due to operator precedence (although the previous
code happened to work because POLLIN has the value 1).
Fixes: 91f986ec99 ("linux-v4l2: Check udev fd events")
Users with AMD CPUs and Intel dGPUs (Arc) would find that QSV is
restricted to 1200p and missing features due to to this check failing.
Once the encoder gets rewritten for AV1 support we will fix this
properly.
udev_event_thread calls poll with two fds: the udev fd, and an eventfd
used for shutdown. On FreeBSD we were hanging on shutdown in
udev_monitor_receive_device after receiving the eventfd event.
Now, if the udev fd reports no events skip the
udev_monitor_receive_device call.
At shutdown the loop will exit via os_event_try().
Currently we use signals based on os_event's but the udev code blocks in
a 1s select (now poll) that cannot be signalled without an FD. This adds
an extra eventfd which will be signalled along with the os_event to
trigger the poll.
Also switches from select to poll to avoid issues with large fd values.
Converting the color space was likely accidental as it isn't explicitly
set. Unfortunately, not setting it means that it gets set to the
default, which is Rec. 709 and thus a conversion takes place when having
any other space. This conversion leads to a massive performance penalty
that isn't necessary.
Adding all windows manually means that any windows opened after the
session was started won't appear. This instead excludes the Control
Center from Display Capture. While unfortunate, it seems to be the only
thing on the display that can't be disabled.
Since this was included in things like the inject helper and game
capture DLLs, it added an additional export to those programs. Instead,
simply share the source files directly in the projects that need it.
Co-authored-by: jpark37 <jpark37@users.noreply.github.com>