mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
LibAudio: Always insert a seek point at sample 0 if not present
Previously, the calculation of the distance to the previous seekpoint would always behave as if a seek point existed at sample 0, meaning that it would never place a seek point there. If we instead treat it as the maximum distance if no sample is present, a seek point will be placed.
This commit is contained in:
parent
a8dc97d95d
commit
ee1903e641
1 changed files with 2 additions and 1 deletions
|
@ -325,7 +325,8 @@ bool FlacLoaderPlugin::should_insert_seekpoint_at(u64 sample_index) const
|
|||
auto const max_seekpoint_distance = (maximum_seekpoint_distance_ms * m_sample_rate) / 1000;
|
||||
auto const seek_tolerance = (seek_tolerance_ms * m_sample_rate) / 1000;
|
||||
auto const current_seekpoint_distance = m_seektable.seek_point_sample_distance_around(sample_index).value_or(NumericLimits<u64>::max());
|
||||
auto const distance_to_previous_seekpoint = sample_index - m_seektable.seek_point_before(sample_index).value_or({ 0, 0 }).sample_index;
|
||||
auto const previous_seekpoint = m_seektable.seek_point_before(sample_index);
|
||||
auto const distance_to_previous_seekpoint = previous_seekpoint.has_value() ? sample_index - previous_seekpoint->sample_index : NumericLimits<u64>::max();
|
||||
|
||||
// We insert a seekpoint only under two conditions:
|
||||
// - The seek points around us are spaced too far for what the loader recommends.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue