Commit 2a7d7198 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '16a4a18d'

* commit '16a4a18d':
  af_asyncts: fix offset calculation
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents fc94b68e 16a4a18d
...@@ -233,18 +233,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) ...@@ -233,18 +233,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
} }
if (s->first_frame && delta > 0) { if (s->first_frame && delta > 0) {
int planar = av_sample_fmt_is_planar(buf_out->format);
int planes = planar ? nb_channels : 1;
int block_size = av_get_bytes_per_sample(buf_out->format) *
(planar ? 1 : nb_channels);
int ch; int ch;
av_samples_set_silence(buf_out->extended_data, 0, delta, av_samples_set_silence(buf_out->extended_data, 0, delta,
nb_channels, buf->format); nb_channels, buf->format);
for (ch = 0; ch < nb_channels; ch++) for (ch = 0; ch < planes; ch++)
buf_out->extended_data[ch] += delta; buf_out->extended_data[ch] += delta * block_size;
avresample_read(s->avr, buf_out->extended_data, out_size); avresample_read(s->avr, buf_out->extended_data, out_size);
for (ch = 0; ch < nb_channels; ch++) for (ch = 0; ch < planes; ch++)
buf_out->extended_data[ch] -= delta; buf_out->extended_data[ch] -= delta * block_size;
} else { } else {
avresample_read(s->avr, buf_out->extended_data, out_size); avresample_read(s->avr, buf_out->extended_data, out_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment