Commit b570f24d authored by Nicolas George's avatar Nicolas George

lavfi/af_asetnsamples: simplify request_frame loop.

parent 9566ba91
...@@ -38,7 +38,6 @@ typedef struct { ...@@ -38,7 +38,6 @@ typedef struct {
int nb_out_samples; ///< how many samples to output int nb_out_samples; ///< how many samples to output
AVAudioFifo *fifo; ///< samples are queued here AVAudioFifo *fifo; ///< samples are queued here
int64_t next_out_pts; int64_t next_out_pts;
int req_fullfilled;
int pad; int pad;
} ASNSContext; } ASNSContext;
...@@ -86,6 +85,7 @@ static int config_props_output(AVFilterLink *outlink) ...@@ -86,6 +85,7 @@ static int config_props_output(AVFilterLink *outlink)
asns->fifo = av_audio_fifo_alloc(outlink->format, nb_channels, asns->nb_out_samples); asns->fifo = av_audio_fifo_alloc(outlink->format, nb_channels, asns->nb_out_samples);
if (!asns->fifo) if (!asns->fifo)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
return 0; return 0;
} }
...@@ -128,7 +128,6 @@ static int push_samples(AVFilterLink *outlink) ...@@ -128,7 +128,6 @@ static int push_samples(AVFilterLink *outlink)
ret = ff_filter_frame(outlink, outsamples); ret = ff_filter_frame(outlink, outsamples);
if (ret < 0) if (ret < 0)
return ret; return ret;
asns->req_fullfilled = 1;
return nb_out_samples; return nb_out_samples;
} }
...@@ -161,15 +160,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) ...@@ -161,15 +160,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
static int request_frame(AVFilterLink *outlink) static int request_frame(AVFilterLink *outlink)
{ {
ASNSContext *asns = outlink->src->priv;
AVFilterLink *inlink = outlink->src->inputs[0]; AVFilterLink *inlink = outlink->src->inputs[0];
int ret; int ret;
asns->req_fullfilled = 0; ret = ff_request_frame(inlink);
do {
ret = ff_request_frame(inlink);
} while (!asns->req_fullfilled && ret >= 0);
if (ret == AVERROR_EOF) { if (ret == AVERROR_EOF) {
ret = push_samples(outlink); ret = push_samples(outlink);
return ret < 0 ? ret : ret > 0 ? 0 : AVERROR_EOF; return ret < 0 ? ret : ret > 0 ? 0 : AVERROR_EOF;
......
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