Don't allow SDL audio capture using pulseaudio

When you start recording using SDL pulseaudio driver the client sends
all audio captured while not recording. 240 milliseconds of audio is
sent each frame until the capture buffer is empty. This is a problem for
privacy and causes confusing to debug VoIP playback issues on other
clients connected to server and when playing back demos.
This commit is contained in:
Zack Middleton 2018-05-12 03:57:53 -05:00
parent 42d2fb908c
commit 2326a060b9

View file

@ -188,6 +188,9 @@ qboolean SNDDMA_Init(void)
SDL_AudioSpec desired;
SDL_AudioSpec obtained;
int tmp;
#ifdef USE_SDL_AUDIO_CAPTURE
SDL_version sdlVersion;
#endif
if (snd_inited)
return qtrue;
@ -286,7 +289,13 @@ qboolean SNDDMA_Init(void)
#ifdef USE_SDL_AUDIO_CAPTURE
// !!! FIXME: some of these SDL_OpenAudioDevice() values should be cvars.
s_sdlCapture = Cvar_Get( "s_sdlCapture", "1", CVAR_ARCHIVE | CVAR_LATCH );
if (!s_sdlCapture->integer)
// !!! FIXME: hopefully pulseaudio capture will be fixed in SDL 2.0.9... https://bugzilla.libsdl.org/show_bug.cgi?id=4087
SDL_GetVersion(&sdlVersion);
if (sdlVersion.major == 2 && sdlVersion.minor == 0 && sdlVersion.patch < 9 && Q_stricmp(SDL_GetCurrentAudioDriver(), "pulseaudio") == 0)
{
Com_Printf("SDL audio capture support disabled (pulseaudio capture does not work correctly with SDL %d.%d.%d)\n", sdlVersion.major, sdlVersion.minor, sdlVersion.patch);
}
else if (!s_sdlCapture->integer)
{
Com_Printf("SDL audio capture support disabled by user ('+set s_sdlCapture 1' to enable)\n");
}