Skip to content

Commit

Permalink
Merge commit '16a4a18db089af8c432f1cdec62155000585b72c'
Browse files Browse the repository at this point in the history
* commit '16a4a18db089af8c432f1cdec62155000585b72c':
  af_asyncts: fix offset calculation

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed May 10, 2013
2 parents fc94b68 + 16a4a18 commit 2a7d719
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions libavfilter/af_asyncts.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
}

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;

av_samples_set_silence(buf_out->extended_data, 0, delta,
nb_channels, buf->format);

for (ch = 0; ch < nb_channels; ch++)
buf_out->extended_data[ch] += delta;
for (ch = 0; ch < planes; ch++)
buf_out->extended_data[ch] += delta * block_size;

avresample_read(s->avr, buf_out->extended_data, out_size);

for (ch = 0; ch < nb_channels; ch++)
buf_out->extended_data[ch] -= delta;
for (ch = 0; ch < planes; ch++)
buf_out->extended_data[ch] -= delta * block_size;
} else {
avresample_read(s->avr, buf_out->extended_data, out_size);

Expand Down

0 comments on commit 2a7d719

Please sign in to comment.