mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
ALSA: Fix a playback data throughput error.
This has the data callback handling and the ALSA writing operation in the wrong order. I have no idea how I missed this...
This commit is contained in:
+5
-2
@@ -29845,10 +29845,13 @@ static ma_result ma_device_step__alsa(ma_device* pDevice, ma_blocking_mode block
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((revents & POLLOUT) != 0) {
|
if ((revents & POLLOUT) != 0) {
|
||||||
|
/* Read data from the client first. */
|
||||||
|
ma_device_handle_backend_data_callback(pDevice, pDeviceStateALSA->pIntermediaryBuffer, NULL, pDevice->playback.internalPeriodSizeInFrames);
|
||||||
|
|
||||||
|
/* Now send the data to ALSA for playback. */
|
||||||
resultALSA = pContextStateALSA->snd_pcm_writei(pDeviceStateALSA->pPCMPlayback, pDeviceStateALSA->pIntermediaryBuffer, pDevice->playback.internalPeriodSizeInFrames);
|
resultALSA = pContextStateALSA->snd_pcm_writei(pDeviceStateALSA->pPCMPlayback, pDeviceStateALSA->pIntermediaryBuffer, pDevice->playback.internalPeriodSizeInFrames);
|
||||||
if (resultALSA >= 0) {
|
if (resultALSA >= 0) {
|
||||||
/* Success. Process the data. */
|
/* Success. */
|
||||||
ma_device_handle_backend_data_callback(pDevice, pDeviceStateALSA->pIntermediaryBuffer, NULL, (ma_uint32)resultALSA);
|
|
||||||
} else {
|
} else {
|
||||||
/* Failed. No data processing will be done this iteration. What we do here depends on the type of error. */
|
/* Failed. No data processing will be done this iteration. What we do here depends on the type of error. */
|
||||||
if (resultALSA == -EAGAIN) {
|
if (resultALSA == -EAGAIN) {
|
||||||
|
|||||||
Reference in New Issue
Block a user