mirror of https://git.videolan.org/git/ffmpeg.git
avfilter/af_afir: kill useless code which increases latency for no reason
This commit is contained in:
parent
07bc603757
commit
16d91b7e99
|
@ -120,17 +120,14 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
AVFilterContext *ctx = outlink->src;
|
||||||
AVFrame *out = NULL;
|
AVFrame *out = NULL;
|
||||||
int ret;
|
|
||||||
|
|
||||||
s->nb_samples = in->nb_samples;
|
s->nb_samples = in->nb_samples;
|
||||||
|
|
||||||
if (!s->want_skip) {
|
|
||||||
out = ff_get_audio_buffer(outlink, s->nb_samples);
|
out = ff_get_audio_buffer(outlink, s->nb_samples);
|
||||||
if (!out) {
|
if (!out) {
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (s->pts == AV_NOPTS_VALUE)
|
if (s->pts == AV_NOPTS_VALUE)
|
||||||
s->pts = in->pts;
|
s->pts = in->pts;
|
||||||
|
@ -139,11 +136,9 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
|
||||||
|
|
||||||
s->part_index = (s->part_index + 1) % s->nb_partitions;
|
s->part_index = (s->part_index + 1) % s->nb_partitions;
|
||||||
|
|
||||||
if (!s->want_skip) {
|
|
||||||
out->pts = s->pts;
|
out->pts = s->pts;
|
||||||
if (s->pts != AV_NOPTS_VALUE)
|
if (s->pts != AV_NOPTS_VALUE)
|
||||||
s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
||||||
}
|
|
||||||
|
|
||||||
s->index++;
|
s->index++;
|
||||||
if (s->index == 3)
|
if (s->index == 3)
|
||||||
|
@ -152,14 +147,7 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
s->in[0] = NULL;
|
s->in[0] = NULL;
|
||||||
|
|
||||||
if (s->want_skip == 1) {
|
return ff_filter_frame(outlink, out);
|
||||||
s->want_skip = 0;
|
|
||||||
ret = 0;
|
|
||||||
} else {
|
|
||||||
ret = ff_filter_frame(outlink, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t color)
|
static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t color)
|
||||||
|
@ -496,16 +484,7 @@ static int activate(AVFilterContext *ctx)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->need_padding) {
|
|
||||||
in = ff_get_audio_buffer(outlink, s->part_size);
|
|
||||||
if (!in)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
s->need_padding = 0;
|
|
||||||
ret = 1;
|
|
||||||
} else {
|
|
||||||
ret = ff_inlink_consume_samples(ctx->inputs[0], s->part_size, s->part_size, &in);
|
ret = ff_inlink_consume_samples(ctx->inputs[0], s->part_size, s->part_size, &in);
|
||||||
}
|
|
||||||
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = fir_frame(s, in, outlink);
|
ret = fir_frame(s, in, outlink);
|
||||||
|
|
||||||
|
@ -626,8 +605,6 @@ static int config_output(AVFilterLink *outlink)
|
||||||
|
|
||||||
s->nb_channels = outlink->channels;
|
s->nb_channels = outlink->channels;
|
||||||
s->nb_coef_channels = ctx->inputs[1]->channels;
|
s->nb_coef_channels = ctx->inputs[1]->channels;
|
||||||
s->want_skip = 1;
|
|
||||||
s->need_padding = 1;
|
|
||||||
s->pts = AV_NOPTS_VALUE;
|
s->pts = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -66,8 +66,6 @@ typedef struct AudioFIRContext {
|
||||||
int nb_coef_channels;
|
int nb_coef_channels;
|
||||||
int one2many;
|
int one2many;
|
||||||
int nb_samples;
|
int nb_samples;
|
||||||
int want_skip;
|
|
||||||
int need_padding;
|
|
||||||
|
|
||||||
RDFTContext **rdft, **irdft;
|
RDFTContext **rdft, **irdft;
|
||||||
float **sum;
|
float **sum;
|
||||||
|
|
Loading…
Reference in New Issue