Move audio capabilities out of the renderer classes

Since the removal of libsoundio, all renderers support arbitrary audio duration, so we can avoid having to start an audio session just to query capabilities.
This commit is contained in:
Cameron Gutman
2025-10-25 19:17:38 -05:00
parent ac7696ea8f
commit 7d544c1ce4
6 changed files with 7 additions and 30 deletions
+7 -13
View File
@@ -95,21 +95,15 @@ bool Session::initializeAudioRenderer()
int Session::getAudioRendererCapabilities(int audioConfiguration)
{
// Build a fake OPUS_MULTISTREAM_CONFIGURATION to give
// the renderer the channel count and sample rate.
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
opusConfig.sampleRate = 48000;
opusConfig.samplesPerFrame = 240;
opusConfig.channelCount = CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(audioConfiguration);
int caps = 0;
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
if (audioRenderer == nullptr) {
return 0;
}
// All audio renderers support arbitrary audio duration
caps |= CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION;
int caps = audioRenderer->getCapabilities();
delete audioRenderer;
#ifdef STEAM_LINK
// Steam Link devices have slow Opus decoders
caps |= CAPABILITY_SLOW_OPUS_DECODER;
#endif
return caps;
}