avfilter/avf_showspectrum: do not use ff_outlink_get_status() on inlink

This commit is contained in:
Paul B Mahol 2023-05-29 23:30:56 +02:00
parent 9f9534f5b6
commit 51a1124a68
1 changed files with 13 additions and 10 deletions

View File

@ -109,6 +109,7 @@ typedef struct ShowSpectrumContext {
float dmin, dmax;
uint64_t samples;
int (*plot_channel)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
int eof;
float opacity_factor;
@ -1543,8 +1544,7 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {
if (s->old_pts < outpicref->pts || s->sliding == FULLFRAME ||
(ff_outlink_get_status(inlink) == AVERROR_EOF &&
ff_inlink_queued_samples(inlink) <= s->hop_size)) {
(s->eof && ff_inlink_queued_samples(inlink) <= s->hop_size)) {
AVFrame *clone;
if (s->legend) {
@ -1600,7 +1600,7 @@ static int activate(AVFilterContext *ctx)
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
if (s->outpicref) {
if (s->outpicref && ff_inlink_queued_samples(inlink) > 0) {
AVFrame *fin;
ret = ff_inlink_consume_samples(inlink, s->hop_size, s->hop_size, &fin);
@ -1627,8 +1627,7 @@ static int activate(AVFilterContext *ctx)
}
}
if (ff_outlink_get_status(inlink) == AVERROR_EOF &&
s->sliding == FULLFRAME &&
if (s->eof && s->sliding == FULLFRAME &&
s->xpos > 0 && s->outpicref) {
if (s->orientation == VERTICAL) {
@ -1656,11 +1655,15 @@ static int activate(AVFilterContext *ctx)
return 0;
}
if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
if (status == AVERROR_EOF) {
ff_outlink_set_status(outlink, status, s->pts);
return 0;
}
if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
s->eof = status == AVERROR_EOF;
ff_filter_set_ready(ctx, 100);
return 0;
}
if (s->eof) {
ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
return 0;
}
if (ff_inlink_queued_samples(inlink) >= s->hop_size) {