roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.02k stars 203 forks source link

Support floats in parse_size() and parse_duration() #654

Closed gavv closed 6 months ago

gavv commented 7 months ago

These two functions parses time and size units like "100ms" or "10M".

Currently, they allow only integer numbers, but it would be nice to support floats too. E.g. "2.5ms" is more convenient than "2500us", as well as "1.5M" vs."1536K".

Unit tests should be updated too.

Code: https://github.com/roc-streaming/roc-toolkit/blob/develop/src/internal_modules/roc_core/parse_units.h Documentation: https://github.com/roc-streaming/roc-toolkit/blob/develop/docs/sphinx/manuals/roc_recv.rst#time-units

nolan-veed commented 6 months ago

I'll do this while I wait on other things.

gavv commented 6 months ago

Thanks!