1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/af_amultiply: use pts from frame from first input

This commit is contained in:
Paul B Mahol 2019-05-04 11:28:14 +02:00
parent 3d8e99eba3
commit e94447cd49

View File

@ -34,7 +34,6 @@ typedef struct AudioMultiplyContext {
const AVClass *class; const AVClass *class;
AVFrame *frames[2]; AVFrame *frames[2];
int64_t pts;
int planes; int planes;
int channels; int channels;
int samples_align; int samples_align;
@ -95,21 +94,20 @@ static int activate(AVFilterContext *ctx)
} }
} }
if (nb_samples > 0 && s->frames[0] && s->frames[1]) { if (s->frames[0] && s->frames[1]) {
AVFrame *out; AVFrame *out;
int plane_samples; int plane_samples;
if (av_sample_fmt_is_planar(ctx->inputs[0]->format)) if (av_sample_fmt_is_planar(ctx->inputs[0]->format))
plane_samples = FFALIGN(nb_samples, s->samples_align); plane_samples = FFALIGN(s->frames[0]->nb_samples, s->samples_align);
else else
plane_samples = FFALIGN(nb_samples * s->channels, s->samples_align); plane_samples = FFALIGN(s->frames[0]->nb_samples * s->channels, s->samples_align);
out = ff_get_audio_buffer(ctx->outputs[0], nb_samples); out = ff_get_audio_buffer(ctx->outputs[0], s->frames[0]->nb_samples);
if (!out) if (!out)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
out->pts = s->pts; out->pts = s->frames[0]->pts;
s->pts += nb_samples;
if (av_get_packed_sample_fmt(ctx->inputs[0]->format) == AV_SAMPLE_FMT_FLT) { if (av_get_packed_sample_fmt(ctx->inputs[0]->format) == AV_SAMPLE_FMT_FLT) {
for (i = 0; i < s->planes; i++) { for (i = 0; i < s->planes; i++) {