aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/rate.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/rate.cpp b/sound/rate.cpp
index 105b5d5d26..5944e64694 100644
--- a/sound/rate.cpp
+++ b/sound/rate.cpp
@@ -196,7 +196,11 @@ LinearRateConverter<stereo, reverseStereo>::LinearRateConverter(st_rate_t inrate
opos = FRAC_ONE;
- /* increment */
+ // Compute the linear interpolation increment.
+ // This will overflow if inrate >= 2^16, and underflow if outrate >= 2^16.
+ // Also, if the quotient of the two rate becomes too small / too big, that
+ // would cause problems, but since we rarely scale from 1 to 65536 Hz or vice
+ // versa, I think we can live with that limiation ;-).
opos_inc = (inrate << FRAC_BITS) / outrate;
ilast0 = ilast1 = 0;