Browse Source

avfilter/asrc_sine: Fix invalid left shift of negative number

by using a multiplication instead. The multiplication can never overflow
an int because the sin-factor is only an int16_t.

Affected the FATE-tests filter-concat and filter-concat-vfr.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 55b46902c1)
tags/n4.4
Andreas Rheinhardt Andreas Rheinhardt 5 years ago
parent
commit
da4b64ea02
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavfilter/asrc_sine.c

+ 1
- 1
libavfilter/asrc_sine.c View File

@@ -247,7 +247,7 @@ static int request_frame(AVFilterLink *outlink)
samples[i] = sine->sin[sine->phi >> (32 - LOG_PERIOD)];
sine->phi += sine->dphi;
if (sine->beep_index < sine->beep_length) {
samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] << 1;
samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] * 2;
sine->phi_beep += sine->dphi_beep;
}
if (++sine->beep_index == sine->beep_period)


Loading…
Cancel
Save