git: f2a60bd4e051 - main - audio/mumble{,-server}: fix build on i386

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Fri, 05 Apr 2024 16:28:06 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f2a60bd4e0516763e390a2ab619db7503a9e3b20

commit f2a60bd4e0516763e390a2ab619db7503a9e3b20
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-04-05 16:24:31 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-04-05 16:27:58 +0000

    audio/mumble{,-server}: fix build on i386
    
    Upstream issue: https://github.com/mumble-voip/mumble/issues/6377
    
    Reported by:    pkg-fallout
    Approved by:    arrowd (mentor, implicit)
---
 audio/mumble-server/Makefile                        |  2 ++
 audio/mumble/files/patch-src_MumbleProtocol.cpp     | 11 +++++++++++
 audio/mumble/files/patch-src_mumble_Audio.cpp       | 11 +++++++++++
 audio/mumble/files/patch-src_mumble_AudioOutput.cpp | 16 ++++++++++++++++
 4 files changed, 40 insertions(+)

diff --git a/audio/mumble-server/Makefile b/audio/mumble-server/Makefile
index cf83a829fe77..1902068cdddb 100644
--- a/audio/mumble-server/Makefile
+++ b/audio/mumble-server/Makefile
@@ -28,6 +28,8 @@ CXXFLAGS+=	-Wno-deprecated-declarations
 USE_RC_SUBR=	mumble_server
 SUB_LIST+=	USERS="${USERS}" GROUPS="${GROUPS}"
 
+EXTRA_PATCHES+=	${.CURDIR}/../mumble/files/patch-src_MumbleProtocol.cpp
+
 OPTIONS_DEFINE=		AVAHI DOCS ICE LTO
 OPTIONS_DEFAULT=	AVAHI LTO MYSQL SQLITE
 OPTIONS_MULTI=		SQL
diff --git a/audio/mumble/files/patch-src_MumbleProtocol.cpp b/audio/mumble/files/patch-src_MumbleProtocol.cpp
new file mode 100644
index 000000000000..2f05950b011a
--- /dev/null
+++ b/audio/mumble/files/patch-src_MumbleProtocol.cpp
@@ -0,0 +1,11 @@
+--- src/MumbleProtocol.cpp.orig	2024-03-03 17:26:27 UTC
++++ src/MumbleProtocol.cpp
+@@ -781,7 +781,7 @@ namespace Protocol {
+ 		}
+ 
+ 
+-		m_audioData.payload = gsl::span< byte >(payloadBegin, payloadSize);
++		m_audioData.payload = gsl::span< byte >(payloadBegin, static_cast< size_t >(payloadSize));
+ 
+ 		if (stream.left() == 3 * sizeof(float)) {
+ 			// If there are further bytes after the audio payload, this means that there is positional data attached to
diff --git a/audio/mumble/files/patch-src_mumble_Audio.cpp b/audio/mumble/files/patch-src_mumble_Audio.cpp
new file mode 100644
index 000000000000..5d7719c14c7c
--- /dev/null
+++ b/audio/mumble/files/patch-src_mumble_Audio.cpp
@@ -0,0 +1,11 @@
+--- src/mumble/Audio.cpp.orig	2024-03-03 17:26:27 UTC
++++ src/mumble/Audio.cpp
+@@ -43,7 +43,7 @@ void LoopUser::addFrame(const Mumble::Protocol::AudioD
+ 		QMutexLocker l(&qmLock);
+ 		bool restart = (qetLastFetch.elapsed() > 100);
+ 
+-		long time = qetTicker.elapsed();
++		long long time = qetTicker.elapsed();
+ 
+ 		float r;
+ 		if (restart)
diff --git a/audio/mumble/files/patch-src_mumble_AudioOutput.cpp b/audio/mumble/files/patch-src_mumble_AudioOutput.cpp
new file mode 100644
index 000000000000..04aaaa44bbb3
--- /dev/null
+++ b/audio/mumble/files/patch-src_mumble_AudioOutput.cpp
@@ -0,0 +1,16 @@
+--- src/mumble/AudioOutput.cpp.orig	2024-03-03 17:26:27 UTC
++++ src/mumble/AudioOutput.cpp
+@@ -617,11 +617,11 @@ bool AudioOutput::mix(void *outbuff, unsigned int fram
+ 						// Mix down stereo to mono. TODO: stereo record support
+ 						// frame: for a stereo stream, the [LR] pair inside ...[LR]LRLRLR.... is a frame
+ 						for (unsigned int i = 0; i < frameCount; ++i) {
+-							recbuff[i] += (pfBuffer[2 * i] / 2.0f + pfBuffer[2 * i + 1] / 2.0f) * volumeAdjustment;
++							recbuff[static_cast< int >(i)] += (pfBuffer[2 * i] / 2.0f + pfBuffer[2 * i + 1] / 2.0f) * volumeAdjustment;
+ 						}
+ 					} else {
+ 						for (unsigned int i = 0; i < frameCount; ++i) {
+-							recbuff[i] += pfBuffer[i] * volumeAdjustment;
++							recbuff[static_cast< int >(i)] += pfBuffer[i] * volumeAdjustment;
+ 						}
+ 					}
+