Commit 0ffceeef authored by David Reid's avatar David Reid

PulseAudio: Fix a possible division by zero.

parent cf02c9e9
...@@ -23465,7 +23465,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -23465,7 +23465,7 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
attr = *pActualAttr; attr = *pActualAttr;
} }
pDescriptorPlayback->periodCount = attr.maxlength / attr.tlength; pDescriptorPlayback->periodCount = ma_max(attr.maxlength / attr.tlength, 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_DEBUG, "[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_DEBUG, "[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);
...@@ -69443,6 +69443,7 @@ REVISION HISTORY ...@@ -69443,6 +69443,7 @@ REVISION HISTORY
v0.10.43 - TBD v0.10.43 - TBD
- ALSA: Fix use of uninitialized variables - ALSA: Fix use of uninitialized variables
- ALSA: Fix enumeration of devices that support both playback and capture. - ALSA: Fix enumeration of devices that support both playback and capture.
- PulseAudio: Fix a possible division by zero.
- WebAudio: Fix errors in strict mode. - WebAudio: Fix errors in strict mode.
v0.10.42 - 2021-08-22 v0.10.42 - 2021-08-22
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment