Skip to content

Commit

Permalink
Merge commit '3799376dd3373ee255651ed542c75b15665801a8'
Browse files Browse the repository at this point in the history
* commit '3799376dd3373ee255651ed542c75b15665801a8':
  lavfi/fifo: fix flushing when using request_samples

Conflicts:
	libavfilter/fifo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information
michaelni committed Aug 6, 2013
2 parents a59a64c + 3799376 commit bb5ef96
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libavfilter/fifo.c
Expand Up @@ -147,10 +147,14 @@ static int return_audio_frame(AVFilterContext *ctx)
{
AVFilterLink *link = ctx->outputs[0];
FifoContext *s = ctx->priv;
AVFrame *head = s->root.next->frame;
AVFrame *head = s->root.next ? s->root.next->frame : NULL;
AVFrame *out;
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 &&
head->nb_samples >= link->request_samples &&
calc_ptr_alignment(head) >= 32) {
Expand Down Expand Up @@ -227,8 +231,11 @@ static int request_frame(AVFilterLink *outlink)
int ret = 0;

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;
}
av_assert0(fifo->root.next);
}

Expand Down

0 comments on commit bb5ef96

Please sign in to comment.