mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
ALSA: Try fixing a failed assertion with MMAP mode.
It appears snd_pcm_mmap_begin() is returning a frame count of 0 (which according to the documentation is apparently possible) which mini_al is not handling properly.
This commit is contained in:
@@ -5183,8 +5183,10 @@ static mal_bool32 mal_device_write__alsa(mal_device* pDevice)
|
||||
return MAL_FALSE;
|
||||
}
|
||||
|
||||
void* pBuffer = (mal_uint8*)pAreas[0].addr + ((pAreas[0].first + (mappedOffset * pAreas[0].step)) / 8);
|
||||
mal_device__read_frames_from_client(pDevice, mappedFrames, pBuffer);
|
||||
if (mappedFrames > 0) {
|
||||
void* pBuffer = (mal_uint8*)pAreas[0].addr + ((pAreas[0].first + (mappedOffset * pAreas[0].step)) / 8);
|
||||
mal_device__read_frames_from_client(pDevice, mappedFrames, pBuffer);
|
||||
}
|
||||
|
||||
result = ((mal_snd_pcm_mmap_commit_proc)pDevice->pContext->alsa.snd_pcm_mmap_commit)((snd_pcm_t*)pDevice->alsa.pPCM, mappedOffset, mappedFrames);
|
||||
if (result < 0 || (snd_pcm_uframes_t)result != mappedFrames) {
|
||||
@@ -5275,8 +5277,10 @@ static mal_bool32 mal_device_read__alsa(mal_device* pDevice)
|
||||
return MAL_FALSE;
|
||||
}
|
||||
|
||||
void* pBuffer = (mal_uint8*)pAreas[0].addr + ((pAreas[0].first + (mappedOffset * pAreas[0].step)) / 8);
|
||||
mal_device__send_frames_to_client(pDevice, mappedFrames, pBuffer);
|
||||
if (mappedFrames > 0) {
|
||||
void* pBuffer = (mal_uint8*)pAreas[0].addr + ((pAreas[0].first + (mappedOffset * pAreas[0].step)) / 8);
|
||||
mal_device__send_frames_to_client(pDevice, mappedFrames, pBuffer);
|
||||
}
|
||||
|
||||
result = ((mal_snd_pcm_mmap_commit_proc)pDevice->pContext->alsa.snd_pcm_mmap_commit)((snd_pcm_t*)pDevice->alsa.pPCM, mappedOffset, mappedFrames);
|
||||
if (result < 0 || (snd_pcm_uframes_t)result != mappedFrames) {
|
||||
|
||||
Reference in New Issue
Block a user