mirror of
https://github.com/RGBCube/serenity
synced 2025-07-05 15:37:34 +00:00
LibAudio: Don't return a seek point if it is after the desired sample
If the seek table was incomplete, without any seek points available before the target point, `SeekTable::seek_point_before()` would instead return the first seek point after the target. Check whether the seek point is before the target before returning it.
This commit is contained in:
parent
42675971e2
commit
a8dc97d95d
1 changed files with 2 additions and 0 deletions
|
@ -40,6 +40,8 @@ Optional<SeekPoint const&> SeekTable::seek_point_before(u64 sample_index) const
|
||||||
++nearby_seek_point_index;
|
++nearby_seek_point_index;
|
||||||
while (nearby_seek_point_index > 0 && m_seek_points[nearby_seek_point_index].sample_index > sample_index)
|
while (nearby_seek_point_index > 0 && m_seek_points[nearby_seek_point_index].sample_index > sample_index)
|
||||||
--nearby_seek_point_index;
|
--nearby_seek_point_index;
|
||||||
|
if (m_seek_points[nearby_seek_point_index].sample_index > sample_index)
|
||||||
|
return {};
|
||||||
return m_seek_points[nearby_seek_point_index];
|
return m_seek_points[nearby_seek_point_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue