diff options
Diffstat (limited to 'third_party/resample/src/resamplesubs.c')
-rw-r--r-- | third_party/resample/src/resamplesubs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/third_party/resample/src/resamplesubs.c b/third_party/resample/src/resamplesubs.c index 51648aea..242844d5 100644 --- a/third_party/resample/src/resamplesubs.c +++ b/third_party/resample/src/resamplesubs.c @@ -307,7 +307,11 @@ static int SrcUD(const RES_HWORD X[], RES_HWORD Y[], double pFactor, Ystart = Y; Yend = Ystart + (unsigned)(nx * pFactor); endTime = time + (1<<Np)*(RES_WORD)nx; - while (time < endTime) + + // Integer round down in dtb calculation may cause (endTime % dtb > 0), + // so it may cause resample write pass the output buffer (Y >= Yend). + // while (time < endTime) + while (Y < Yend) { xp = &X[time>>Np]; /* Ptr to current input sample */ v = FilterUD(pImp, pImpD, pNwing, Interp, xp, (RES_HWORD)(time&Pmask), |