[embedded] Make sure integer does not wrap around for small ratios
Fix compiler warning related to implicit conversion
This makes sure, given some ratio that the resulting number of samples is between 1 and the largest representable std::size_t.
The given ratio is clamped to the interval (0,1] if it's outside that range.
Fixes #942 (closed)