Switch to faster nanors Reed-Solomon implementation (#753)

This commit is contained in:
Cameron Gutman 2023-01-14 08:45:12 -06:00 committed by GitHub
parent 696a11942c
commit 5480d3d59d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

4
.gitmodules vendored
View File

@ -42,3 +42,7 @@
path = third-party/ffmpeg-macos-aarch64
url = https://github.com/LizardByte/build-deps
branch = ffmpeg-macos-aarch64
[submodule "third-party/nanors"]
path = third-party/nanors
url = https://github.com/sleepybishop/nanors.git
branch = master

View File

@ -337,8 +337,8 @@ configure_file(version.h.in version.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SUNSHINE_TARGET_FILES
third-party/moonlight-common-c/reedsolomon/rs.c
third-party/moonlight-common-c/reedsolomon/rs.h
third-party/nanors/rs.c
third-party/nanors/rs.h
third-party/moonlight-common-c/src/Input.h
third-party/moonlight-common-c/src/Rtsp.h
third-party/moonlight-common-c/src/RtspParser.c
@ -385,6 +385,9 @@ set(SUNSHINE_TARGET_FILES
set_source_files_properties(src/upnp.cpp PROPERTIES COMPILE_FLAGS -Wno-pedantic)
set_source_files_properties(third-party/nanors/rs.c
PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
# Pre-compiled binaries
if(WIN32)
set(FFMPEG_PREPARED_BINARIES "${CMAKE_CURRENT_SOURCE_DIR}/third-party/ffmpeg-windows-x86_64")
@ -424,7 +427,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/third-party
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/enet/include
${CMAKE_CURRENT_SOURCE_DIR}/third-party/moonlight-common-c/reedsolomon
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors
${CMAKE_CURRENT_SOURCE_DIR}/third-party/nanors/deps/obl
${FFMPEG_INCLUDE_DIRS}
${PLATFORM_INCLUDE_DIRS}
)

View File

@ -1077,8 +1077,7 @@ void audioBroadcastThread(udp::socket &sock) {
// works correctly. This is possible because the data and FEC shard count is
// constant and known in advance.
const unsigned char parity[] = { 0x77, 0x40, 0x38, 0x0e, 0xc7, 0xa7, 0x0d, 0x6c };
memcpy(&rs.get()->m[16], parity, sizeof(parity));
memcpy(rs.get()->parity, parity, sizeof(parity));
memcpy(rs.get()->p, parity, sizeof(parity));
audio_packet->rtp.header = 0x80;
audio_packet->rtp.packetType = 97;

1
third-party/nanors vendored Submodule

@ -0,0 +1 @@
Subproject commit 395e5ada44dd8d5974eaf6bb6b17f23406e3ca72