diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 13:02:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 13:02:29 +0200 |
commit | e4c0f258d38a961aff463c8474936771be7c561e (patch) | |
tree | 9d806b02d731c883d6e1b2d82ca22f91ca988b5b /libavfilter/fifo.c | |
parent | 645d0384e85bb40b2307c559d0cfc914438e5bff (diff) | |
parent | 9bfc6e02bae9de354fb9ba09a8a140e83eeadf7d (diff) | |
download | ffmpeg-e4c0f258d38a961aff463c8474936771be7c561e.tar.gz |
Merge commit '9bfc6e02bae9de354fb9ba09a8a140e83eeadf7d'
* commit '9bfc6e02bae9de354fb9ba09a8a140e83eeadf7d':
afifo: fix request_samples on the last frame in certain cases
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/fifo.c')
-rw-r--r-- | libavfilter/fifo.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c index ba72cca07f..b06720ec17 100644 --- a/libavfilter/fifo.c +++ b/libavfilter/fifo.c @@ -183,8 +183,25 @@ static int return_audio_frame(AVFilterContext *ctx) } while (s->out->nb_samples < s->allocated_samples) { - int len = FFMIN(s->allocated_samples - s->out->nb_samples, - head->nb_samples); + int len; + + if (!s->root.next) { + ret = ff_request_frame(ctx->inputs[0]); + if (ret == AVERROR_EOF) { + av_samples_set_silence(s->out->extended_data, + s->out->nb_samples, + s->allocated_samples - + s->out->nb_samples, + nb_channels, link->format); + s->out->nb_samples = s->allocated_samples; + break; + } else if (ret < 0) + return ret; + } + head = s->root.next->frame; + + len = FFMIN(s->allocated_samples - s->out->nb_samples, + head->nb_samples); av_samples_copy(s->out->extended_data, head->extended_data, s->out->nb_samples, 0, len, nb_channels, @@ -194,21 +211,6 @@ static int return_audio_frame(AVFilterContext *ctx) if (len == head->nb_samples) { av_frame_free(&head); queue_pop(s); - - if (!s->root.next && - (ret = ff_request_frame(ctx->inputs[0])) < 0) { - if (ret == AVERROR_EOF) { - av_samples_set_silence(s->out->extended_data, - s->out->nb_samples, - s->allocated_samples - - s->out->nb_samples, - nb_channels, link->format); - s->out->nb_samples = s->allocated_samples; - break; - } - return ret; - } - head = s->root.next->frame; } else { buffer_offset(link, head, len); } |