This commit introduces initial support for MacOS as third major host platform.
It relies on the VideoToolbox framework for audio and video processing, which
enables hardware accelerated processing of the stream on most platforms.
Audio capturing requires third party tools as MacOS does not offer the
recording of the audio output like the other platforms do. The commit enables
most features offered by Sunshine for MacOS with the big exception of gamepad
support. The patch sets was tested by a few volunteers, which allowed to remove
some of the early bugs. However, several bugs especially regarding corner
cases have probably not surfaced yet.
Besides instructions how to build from source, the commit also adds a Portfile
that allows a more easy installation. After available on the release branch,
a pull request for the Portfile in the MacPorts project is planned.
Signed-off-by: Anselm Busse <anselm.busse@outlook.com>
* Increase vbv-bufsize to 1/10 of requested bitrate. The previous value
was too low, which was resulting in poor encoding quality and failure to
stabilize at the requested bitrate. Setting to 1/10 of bitrate is a
good compromise, as it avoids quality loss but also prevents bandwidth
spikes far above the bitrate/vbv-maxrate.
* With vbv-bufsize set to a more appropriate value, testing shows that
the average bitrate vs client-requested bandwidth overshoots by ~20%.
Adjust for this scenario in the software encoding case only.
The internal assembly routines inside libswscale perform the
RGB->YUV conversion using a fully planar output format, then
have to perform an additional YUV420->NV12 conversion step.
NVENC can directly consume YUV420 input frames, so we can
completely avoid this NV12 conversion and save quite a bit of
CPU time in the process.
We're not offloading scaling and YUV conversion from the CPU yet,
so the gains aren't as high as one of the fully accelerated
backends like Windows NVENC or Linux VAAPI.
Still, offloading the H.264/HEVC encoding itself is an improvement
over doing everything on the CPU.