aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-06 09:35:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-06 09:35:03 +0200
commitbb5ef961647f06425eff236d9575db0ab6ae66f1 (patch)
tree6f5148c7061625a39caedc299d8477aeeb00139b
parenta59a64cbc85375b7a6a0266c62f654e2ea80a5c6 (diff)
parent3799376dd3373ee255651ed542c75b15665801a8 (diff)
downloadffmpeg-bb5ef961647f06425eff236d9575db0ab6ae66f1.tar.gz
Merge commit '3799376dd3373ee255651ed542c75b15665801a8'
* commit '3799376dd3373ee255651ed542c75b15665801a8': lavfi/fifo: fix flushing when using request_samples Conflicts: libavfilter/fifo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/fifo.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c
index b06720ec17..efc89685c9 100644
--- a/libavfilter/fifo.c
+++ b/libavfilter/fifo.c
@@ -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) {
@@ -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);
}