From b337ee2f2b85ab927466fa0ee6901cedf15501fc Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 7 Oct 2021 18:10:26 +0200 Subject: [PATCH] vfs_oss: fix output fragment limit calculations Fixes #4289 --- repos/libports/src/lib/vfs/oss/vfs_oss.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/repos/libports/src/lib/vfs/oss/vfs_oss.cc b/repos/libports/src/lib/vfs/oss/vfs_oss.cc index b94c0fcbfb..bcb0aa460a 100644 --- a/repos/libports/src/lib/vfs/oss/vfs_oss.cc +++ b/repos/libports/src/lib/vfs/oss/vfs_oss.cc @@ -169,7 +169,7 @@ struct Vfs::Oss_file_system::Audio _info.channels = CHANNELS; _info.format = (unsigned)AFMT_S16_LE; _info.sample_rate = Audio_out::SAMPLE_RATE; - _info.ofrag_total = Audio_out::QUEUE_SIZE; + _info.ofrag_total = Audio_out::QUEUE_SIZE - 2; _info.ofrag_size = (unsigned)Audio_out::PERIOD * (unsigned)CHANNELS * sizeof (int16_t); @@ -558,7 +558,8 @@ struct Vfs::Oss_file_system::Local_factory : File_system_factory *this, &Vfs::Oss_file_system::Local_factory::_play_underruns_changed }; - static constexpr size_t _native_stream_size { Audio_out::QUEUE_SIZE * _stream_packet_size }; + static constexpr size_t _native_stream_size { (Audio_out::QUEUE_SIZE - 2) * + _stream_packet_size }; static constexpr size_t _ofrag_total_min { 2 }; static constexpr size_t _ofrag_size_min { _stream_packet_size }; static constexpr size_t _ofrag_total_max { _native_stream_size / _ofrag_size_min };