128 Commits

Author SHA1 Message Date
Michael Rogers
1ad0c93ad8 Changed the video packet to contain AVPacket instead of extending it. 2022-04-12 16:13:05 -05:00
Mathias Tillman
6fca2c593c Use session_t destructor to ensure the context and hwdevice are always destroyed in the correct order. 2022-03-10 09:09:24 +01:00
Mathias Tillman
a31c6c4cd0 Fix hwdevice being destroyed before context, causing a sigsegv because the context relies on the hwdevice still being active. 2022-03-09 16:20:51 +01:00
Anselm Busse
2b450839a1 Initial support for MacOS
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>
2022-02-26 10:18:00 +01:00
ReenigneArcher
d6183430ef clang lint 2022-02-16 18:23:56 -05:00
Conn O'Griofa
1b6bf8fa34 video: use a better vbv-bufsize & correct software bitrate calculation
* 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.
2022-01-18 09:42:25 +01:00
loki-47-6F-64
8b9cd51134 Merge branch 'master' of github.com:loki-47-6F-64/sunshine 2021-09-27 19:12:51 +02:00
loki-47-6F-64
9f14b2278d Fix rate control for hevc with amdvce 2021-09-27 19:12:42 +02:00
loki-47-6F-64
e287404992 Handle acquiring display names based on encoder 2021-09-25 14:44:38 +02:00
loki-47-6F-64
bb912786bd Added NvFBC on Linux 2021-09-22 11:36:59 +02:00
loki-47-6F-64
fed329568c Use an actual cuda kernel to convert RGB to NV12 2021-09-19 20:40:34 +02:00
loki-47-6F-64
9982ae4675 Convert images on the GPU on Linux for NVidia cards 2021-09-14 11:58:21 +02:00
loki
ebf9dbe931 Merge branch 'kmsgrab' 2021-08-19 22:19:46 +02:00
loki
0f4cdc2d21 Fix hanging when switching monitors 2021-08-18 21:13:55 +02:00
loki
869b6ed89d Fix VAAPI with intel iGPU's 2021-08-18 20:19:15 +02:00
loki
fc7ec9e538 Better validation of vaapi capability 2021-08-17 21:15:38 +02:00
loki-47-6F-64
b58279beea Omit one copy for display_vrm on Windows 2021-08-15 00:36:31 +02:00
loki
24403cdd25 Fix segfault when switching monitors with kmsgrab 2021-08-08 13:42:25 +02:00
loki
2af179630a Switch monitors based on keyboard shortcuts 2021-07-29 16:48:03 +02:00
loki
7ddf8bbe94 Capturing images by callback, rather than pulling 2021-07-26 18:09:07 +02:00
loki
a87782b025 Fix stuttering on Windows 2021-07-26 14:37:57 +02:00
Loki
ab70a056fc Add CQP for older intel iGPU's 2021-07-24 19:33:23 +01:00
loki
63b920cd7b Merge branch 'master' into rumble 2021-07-23 20:07:03 +02:00
loki
bc52fe9b82 Improve fps for software encoding on Windows 2021-07-23 17:36:32 +02:00
loki
1fda8f6219 Support Rumble on Windows 2021-07-18 11:05:34 +02:00
loki
62abd1ee19 Merge branch 'master' of github.com:loki-47-6F-64/sunshine 2021-07-10 23:49:38 +02:00
loki
d55c6ee84c Fix incorrect scaling of absolute mouse coordinates (again) 2021-07-10 23:49:04 +02:00
Cameron Gutman
a7171d77db Reduce CPU usage with Linux NVENC
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.
2021-07-10 11:24:13 -05:00
loki-47-6F-64
61be0eb051
Merge pull request #120 from cgutman/nvenc_linux
Add basic NVENC support on Linux
2021-07-10 17:30:51 +02:00
Cameron Gutman
971c784f14 Add basic NVENC support on Linux
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.
2021-07-09 08:13:05 -05:00
loki
747ba7f23a fix incorrect pix_fmt 2021-07-09 14:21:57 +02:00
loki
3d81b0fe7a Remove redundant code 2021-07-06 20:54:29 +02:00
Cameron Gutman
667878d2eb Fix IDR frame delays after packet loss or client request
This can lead to spurious poor connection warnings in Moonlight.
2021-07-05 17:55:32 -05:00
loki
b67600962a Fix incorrect scaling for absolute mouse coordinates 2021-06-24 20:53:19 +02:00
loki
926e95f527 Fix absolute mouse coordinates with multiple monitors on Windows 2021-06-23 21:51:15 +02:00
loki
029194cb60 Fix incorrect abs mouse coordinates on Linux when scaling to different aspect ratio 2021-06-23 14:05:09 +02:00
loki
7e3abefc2c pass session event objects through safe::mail_t 2021-06-22 22:26:11 +02:00
loki
0a05c28df8 fixed incorrect colors when scaling with software 2021-06-20 16:13:34 +02:00
loki
0034438c9e fixed incorrect colors when scaling with software 2021-06-20 15:58:13 +02:00
loki
9e7ecf8db2 Allow replacement of hevc headers 2021-06-20 15:29:51 +02:00
loki
63d15333f2 Allow injecting more than one type of header data into video 2021-06-18 17:27:56 +02:00
loki
23b09e3d41 fix an issue causing free called on unallocated data 2021-06-17 23:26:25 +02:00
loki
fa0ff91d23 some minor refactoring 2021-06-14 20:47:30 +02:00
loki
13caabaec8 fix h264 vui params 2021-06-14 17:43:21 +02:00
Loki
8f2e00f31b minor refactoring 2021-06-14 14:54:09 +02:00
Loki
78244a48d2 remove two redundent tests for encoder validation 2021-06-14 14:44:17 +02:00
loki
8e32c8e6f4 Inject VUI data in SPS header if missing 2021-06-13 21:29:32 +02:00
loki
30f7742f51 Test for presence of sps->vui parameters 2021-06-12 23:08:20 +02:00
loki
e2874b40c1 unfinished vaapi encoder should not be default yet 2021-06-08 22:38:48 +02:00
Loki
3a3d4928f9 Fix compilation on Windows 2021-06-07 14:22:23 +02:00