mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 00:34:03 +02:00
PulseAudio: Try fixing a division by zero error.
Public issue https://github.com/mackron/miniaudio/issues/412
This commit is contained in:
+11
-2
@@ -28951,9 +28951,13 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
attr = *pActualAttr;
|
attr = *pActualAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDescriptorCapture->periodCount = attr.maxlength / attr.fragsize;
|
if (attr.fragsize > 0) {
|
||||||
pDescriptorCapture->periodSizeInFrames = attr.maxlength / ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels) / pDescriptorCapture->periodCount;
|
pDescriptorPlayback->periodCount = ma_max(attr.maxlength / attr.fragsize, 1);
|
||||||
|
} else {
|
||||||
|
pDescriptorPlayback->periodCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDescriptorCapture->periodSizeInFrames = attr.maxlength / ma_get_bytes_per_frame(pDescriptorCapture->format, pDescriptorCapture->channels) / pDescriptorCapture->periodCount;
|
||||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Capture actual attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; periodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorCapture->periodSizeInFrames);
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Capture actual attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; periodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorCapture->periodSizeInFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29058,7 +29062,12 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
|
|||||||
attr = *pActualAttr;
|
attr = *pActualAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attr.tlength > 0) {
|
||||||
pDescriptorPlayback->periodCount = ma_max(attr.maxlength / attr.tlength, 1);
|
pDescriptorPlayback->periodCount = ma_max(attr.maxlength / attr.tlength, 1);
|
||||||
|
} else {
|
||||||
|
pDescriptorPlayback->periodCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
pDescriptorPlayback->periodSizeInFrames = attr.maxlength / ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels) / pDescriptorPlayback->periodCount;
|
pDescriptorPlayback->periodSizeInFrames = attr.maxlength / ma_get_bytes_per_frame(pDescriptorPlayback->format, pDescriptorPlayback->channels) / pDescriptorPlayback->periodCount;
|
||||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback actual attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; internalPeriodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorPlayback->periodSizeInFrames);
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_INFO, "[PulseAudio] Playback actual attr: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d, fragsize=%d; internalPeriodSizeInFrames=%d\n", attr.maxlength, attr.tlength, attr.prebuf, attr.minreq, attr.fragsize, pDescriptorPlayback->periodSizeInFrames);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user