mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
SoundPlayer: Don't try to dereference null-pointer buffers
d049626f40
tried to resample the buffer
before checking if it points to a valid location.
This caused a crash, generally at the end of the file.
This commit is contained in:
parent
0139a56aa5
commit
d81ba98976
1 changed files with 5 additions and 4 deletions
|
@ -118,10 +118,11 @@ void PlaybackManager::next_buffer()
|
||||||
|
|
||||||
if (audio_server_remaining_samples < m_device_samples_per_buffer) {
|
if (audio_server_remaining_samples < m_device_samples_per_buffer) {
|
||||||
m_current_buffer = m_loader->get_more_samples(m_source_buffer_size_bytes);
|
m_current_buffer = m_loader->get_more_samples(m_source_buffer_size_bytes);
|
||||||
VERIFY(m_resampler.has_value());
|
if (m_current_buffer) {
|
||||||
m_resampler->reset();
|
VERIFY(m_resampler.has_value());
|
||||||
m_current_buffer = Audio::resample_buffer(m_resampler.value(), *m_current_buffer);
|
m_resampler->reset();
|
||||||
if (m_current_buffer)
|
m_current_buffer = Audio::resample_buffer(m_resampler.value(), *m_current_buffer);
|
||||||
m_connection->enqueue(*m_current_buffer);
|
m_connection->enqueue(*m_current_buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue