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.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -247,7 +247,7 @@ static int request_frame(AVFilterLink *outlink) · 246 unmodified lines | |||
| 247 | samples[i] = sine->sin[sine->phi >> (32 - LOG_PERIOD)]; | 247 | samples[i] = sine->sin[sine->phi >> (32 - LOG_PERIOD)]; |
| 248 | sine->phi += sine->dphi; | 248 | sine->phi += sine->dphi; |
| 249 | if (sine->beep_index < sine->beep_length) { | 249 | if (sine->beep_index < sine->beep_length) { |
| 250 | samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] << 1; | 250 | samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] * 2; |
| 251 | sine->phi_beep += sine->dphi_beep; | 251 | sine->phi_beep += sine->dphi_beep; |
| 252 | } | 252 | } |
| 253 | if (++sine->beep_index == sine->beep_period) | 253 | if (++sine->beep_index == sine->beep_period) |