mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 16:13:46 +01:00
OpenALSoundManager: Fix a buffer overflow
This commit is contained in:
parent
531122ee86
commit
03dda13910
@ -730,10 +730,13 @@ f32 PlayingSound::getGain() noexcept
|
|||||||
void OpenALSoundManager::stepStreams(f32 dtime)
|
void OpenALSoundManager::stepStreams(f32 dtime)
|
||||||
{
|
{
|
||||||
// spread work across steps
|
// spread work across steps
|
||||||
int num_issued_sounds = std::ceil(m_sounds_streaming_current_bigstep.size()
|
const size_t num_issued_sounds = std::min(
|
||||||
* dtime / m_stream_timer);
|
m_sounds_streaming_current_bigstep.size(),
|
||||||
|
(size_t)std::ceil(m_sounds_streaming_current_bigstep.size()
|
||||||
|
* dtime / m_stream_timer)
|
||||||
|
);
|
||||||
|
|
||||||
for (; num_issued_sounds > 0; --num_issued_sounds) {
|
for (size_t i = 0; i < num_issued_sounds; ++i) {
|
||||||
auto wptr = std::move(m_sounds_streaming_current_bigstep.back());
|
auto wptr = std::move(m_sounds_streaming_current_bigstep.back());
|
||||||
m_sounds_streaming_current_bigstep.pop_back();
|
m_sounds_streaming_current_bigstep.pop_back();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user