CubebAudioStream: Continue even without minimum latency

Fixes audio not functioning on Android.
This commit is contained in:
Connor McLaughlin 2020-07-29 02:23:14 +10:00
parent 982c428074
commit c7b457de9e

View file

@ -47,6 +47,13 @@ bool CubebAudioStream::OpenDevice()
u32 latency_frames = 0; u32 latency_frames = 0;
rv = cubeb_get_min_latency(m_cubeb_context, &params, &latency_frames); rv = cubeb_get_min_latency(m_cubeb_context, &params, &latency_frames);
if (rv == CUBEB_ERROR_NOT_SUPPORTED)
{
Log_WarningPrintf("Cubeb backend does not support latency queries, using buffer size of %u.", m_buffer_size);
latency_frames = m_buffer_size;
}
else
{
if (rv != CUBEB_OK) if (rv != CUBEB_OK)
{ {
Log_ErrorPrintf("Could not get minimum latency: %d", rv); Log_ErrorPrintf("Could not get minimum latency: %d", rv);
@ -71,6 +78,7 @@ bool CubebAudioStream::OpenDevice()
{ {
latency_frames = m_buffer_size; latency_frames = m_buffer_size;
} }
}
char stream_name[32]; char stream_name[32];
std::snprintf(stream_name, sizeof(stream_name), "AudioStream_%p", this); std::snprintf(stream_name, sizeof(stream_name), "AudioStream_%p", this);