Commit bb5ef961 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '3799376d'

* commit '3799376d':
  lavfi/fifo: fix flushing when using request_samples

Conflicts:
	libavfilter/fifo.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents a59a64cb 3799376d
...@@ -147,10 +147,14 @@ static int return_audio_frame(AVFilterContext *ctx) ...@@ -147,10 +147,14 @@ static int return_audio_frame(AVFilterContext *ctx)
{ {
AVFilterLink *link = ctx->outputs[0]; AVFilterLink *link = ctx->outputs[0];
FifoContext *s = ctx->priv; FifoContext *s = ctx->priv;
AVFrame *head = s->root.next->frame; AVFrame *head = s->root.next ? s->root.next->frame : NULL;
AVFrame *out; AVFrame *out;
int ret; int ret;
/* if head is NULL then we're flushing the remaining samples in out */
if (!head && !s->out)
return AVERROR_EOF;
if (!s->out && if (!s->out &&
head->nb_samples >= link->request_samples && head->nb_samples >= link->request_samples &&
calc_ptr_alignment(head) >= 32) { calc_ptr_alignment(head) >= 32) {
...@@ -227,8 +231,11 @@ static int request_frame(AVFilterLink *outlink) ...@@ -227,8 +231,11 @@ static int request_frame(AVFilterLink *outlink)
int ret = 0; int ret = 0;
if (!fifo->root.next) { if (!fifo->root.next) {
if ((ret = ff_request_frame(outlink->src->inputs[0])) < 0) if ((ret = ff_request_frame(outlink->src->inputs[0])) < 0) {
if (ret == AVERROR_EOF && outlink->request_samples)
return return_audio_frame(outlink->src);
return ret; return ret;
}
av_assert0(fifo->root.next); av_assert0(fifo->root.next);
} }
......
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