Skip to content

Commit 38a543c

Browse files
committed
Try fixing some glitching with the AAudio backend.
1 parent 60d757a commit 38a543c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

miniaudio.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40392,6 +40392,7 @@ static ma_aaudio_data_callback_result_t ma_stream_data_callback_playback__aaudio
4039240392
though I've not yet had any reports about that one.
4039340393
*/
4039440394
if (frameCount > 0) {
40395+
/*ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "AAudio Playback Callback: frameCount=%d, async.frameCap=%d\n", frameCount, pDeviceStateAAudio->async.playback.frameCap);*/
4039540396
ma_device_state_async_process(&pDeviceStateAAudio->async, pDevice, pAudioData, NULL, (ma_uint32)frameCount);
4039640397
}
4039740398

@@ -46310,12 +46311,14 @@ MA_API void ma_device_state_async_process(ma_device_state_async* pAsyncDeviceSta
4631046311
pAsyncDeviceState->capture.frameCount += framesToCopy;
4631146312

4631246313
/* If we just filled up the buffer with data, it's time to release the semaphore. */
46313-
if (pAsyncDeviceState->capture.frameCount == pAsyncDeviceState->capture.frameCap) {
46314+
/*if (pAsyncDeviceState->capture.frameCount == pAsyncDeviceState->capture.frameCap) {
4631446315
ma_semaphore_release(&pAsyncDeviceState->capture.semaphore);
46315-
}
46316+
}*/
4631646317
}
4631746318
}
4631846319
ma_spinlock_unlock(&pAsyncDeviceState->capture.lock);
46320+
46321+
ma_semaphore_release(&pAsyncDeviceState->capture.semaphore);
4631946322
} else {
4632046323
MA_ASSERT(MA_FALSE); /* Should never get here. */
4632146324
}
@@ -46345,11 +46348,13 @@ MA_API void ma_device_state_async_process(ma_device_state_async* pAsyncDeviceSta
4634546348
}
4634646349

4634746350
/* If we just emptied the buffer, it's time to release the semaphore. */
46348-
if (pAsyncDeviceState->playback.frameCount == 0) {
46351+
/*if (pAsyncDeviceState->playback.frameCount == 0) {
4634946352
ma_semaphore_release(&pAsyncDeviceState->playback.semaphore);
46350-
}
46353+
}*/
4635146354
}
4635246355
ma_spinlock_unlock(&pAsyncDeviceState->playback.lock);
46356+
46357+
ma_semaphore_release(&pAsyncDeviceState->playback.semaphore);
4635346358
} else {
4635446359
MA_ASSERT(MA_FALSE); /* Should never get here. */
4635546360
}

0 commit comments

Comments
 (0)