mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 12:15:33 +00:00
bug 1215096 correct off-by-one error in playback position of resampled buffers r=padenot
"The behavior of an expression of the form E1 op = E2 is equivalent to E1 = E1 op E2 except that E1 is evaluated only once", which means that the subtraction of -= was happening before conversion from double to unsigned int. The "+ 0.5" was subtracted before the truncation toward zero, causing rounding to nearest minus one, except when nearest was zero. --HG-- extra : rebase_source : 3b2335da7a244245ea2fcf5c80760dc1645e6dae
This commit is contained in:
parent
145e364521
commit
fef64ad5d0
@ -270,7 +270,8 @@ public:
|
||||
if (leadTicks > 0.0) {
|
||||
// Round to nearest output subsample supported by the resampler at
|
||||
// these rates.
|
||||
skipFracNum -= leadTicks * ratioNum + 0.5;
|
||||
uint32_t leadSubsamples = leadTicks * ratioNum + 0.5;
|
||||
skipFracNum -= leadSubsamples;
|
||||
MOZ_ASSERT(skipFracNum < INT32_MAX, "mBeginProcessing is wrong?");
|
||||
}
|
||||
speex_resampler_set_skip_frac_num(resampler, skipFracNum);
|
||||
|
Loading…
Reference in New Issue
Block a user