Improve low bandwidth audio performance for SDL and SLAudio and fix RTSP issues with broken PMTUD

This commit is contained in:
Cameron Gutman 2019-11-30 22:24:28 -06:00
commit 5700272dc4
5 changed files with 8 additions and 12 deletions

View file

@ -23,7 +23,6 @@ bool SLAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o
// it's hard to avoid since we get crushed by CPU limitations.
m_MaxQueuedAudioMs = 40 * opusConfig->channelCount / 2;
m_FrameDuration = opusConfig->samplesPerFrame / 48;
m_AudioBufferSize = opusConfig->samplesPerFrame * sizeof(short) * opusConfig->channelCount;
m_AudioStream = SLAudio_CreateStream(m_AudioContext,
opusConfig->sampleRate,
@ -37,8 +36,8 @@ bool SLAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o
}
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Using SLAudio renderer with %d ms frames",
m_FrameDuration);
"Using SLAudio renderer with %d samples per frame",
opusConfig->samplesPerFrame);
return true;
}
@ -100,7 +99,7 @@ bool SLAudioRenderer::submitAudio(int bytesWritten)
return true;
}
if (LiGetPendingAudioFrames() * m_FrameDuration < m_MaxQueuedAudioMs) {
if (LiGetPendingAudioDuration() < m_MaxQueuedAudioMs) {
SLAudio_SubmitFrame(m_AudioStream);
m_AudioBuffer = nullptr;
}
@ -115,7 +114,7 @@ bool SLAudioRenderer::submitAudio(int bytesWritten)
int SLAudioRenderer::getCapabilities()
{
return CAPABILITY_SLOW_OPUS_DECODER;
return CAPABILITY_SLOW_OPUS_DECODER | CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION;
}
void SLAudioRenderer::slLogCallback(void*, ESLAudioLog logLevel, const char *message)