Commit e94447cd authored by Paul B Mahol's avatar Paul B Mahol

avfilter/af_amultiply: use pts from frame from first input

parent 3d8e99eb
...@@ -34,7 +34,6 @@ typedef struct AudioMultiplyContext { ...@@ -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) ...@@ -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++) {
......
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