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:
parent
ac7696ea8f
commit
7d544c1ce4
6 changed files with 7 additions and 30 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ public:
|
|||
// Return false if an unrecoverable error has occurred and the renderer must be reinitialized
|
||||
virtual bool submitAudio(int bytesWritten) = 0;
|
||||
|
||||
virtual int getCapabilities() = 0;
|
||||
|
||||
virtual void remapChannels(POPUS_MULTISTREAM_CONFIGURATION) {
|
||||
// Use default channel mapping:
|
||||
// 0 - Front Left
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ public:
|
|||
|
||||
virtual bool submitAudio(int bytesWritten);
|
||||
|
||||
virtual int getCapabilities();
|
||||
|
||||
virtual AudioFormat getAudioBufferFormat();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -132,12 +132,6 @@ bool SdlAudioRenderer::submitAudio(int bytesWritten)
|
|||
return true;
|
||||
}
|
||||
|
||||
int SdlAudioRenderer::getCapabilities()
|
||||
{
|
||||
// Direct submit can't be used because we use LiGetPendingAudioDuration()
|
||||
return CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION;
|
||||
}
|
||||
|
||||
IAudioRenderer::AudioFormat SdlAudioRenderer::getAudioBufferFormat()
|
||||
{
|
||||
return AudioFormat::Float32NE;
|
||||
|
|
|
|||
|
|
@ -114,11 +114,6 @@ bool SLAudioRenderer::submitAudio(int bytesWritten)
|
|||
return true;
|
||||
}
|
||||
|
||||
int SLAudioRenderer::getCapabilities()
|
||||
{
|
||||
return CAPABILITY_SLOW_OPUS_DECODER | CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION;
|
||||
}
|
||||
|
||||
IAudioRenderer::AudioFormat SLAudioRenderer::getAudioBufferFormat()
|
||||
{
|
||||
return AudioFormat::Sint16NE;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ public:
|
|||
|
||||
virtual bool submitAudio(int bytesWritten);
|
||||
|
||||
virtual int getCapabilities();
|
||||
|
||||
virtual AudioFormat getAudioBufferFormat();
|
||||
|
||||
virtual void remapChannels(POPUS_MULTISTREAM_CONFIGURATION opusConfig);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue