From be75fed9755c1285ba084574aff2d7ee0f81110d Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Thu, 13 Dec 2012 16:20:19 +0100 Subject: [PATCH 1/3] vp6: properly fail on unsupported feature Interlacing is not supported at all and mismanaged down the normal codepaths causing possible buffer management issues. CC: libav-stable@libav.org --- libavcodec/vp6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c index 826b77741c..c3428fef5f 100644 --- a/libavcodec/vp6.c +++ b/libavcodec/vp6.c @@ -64,8 +64,8 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, return 0; s->filter_header = buf[1] & 0x06; if (buf[1] & 1) { - av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); - return 0; + av_log_missing_feature(s->avctx, "Interlacing", 0); + return AVERROR_PATCHWELCOME; } if (separated_coeff || !s->filter_header) { coeff_offset = AV_RB16(buf+2) - 2; From f266486b2e71d2965a19a505e83ead3cc1b198e0 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 12 Dec 2012 13:10:13 -0500 Subject: [PATCH 2/3] asyncts: fix flushing of final samples at EOF --- libavfilter/af_asyncts.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c index 5d009f020b..67f3c4fdde 100644 --- a/libavfilter/af_asyncts.c +++ b/libavfilter/af_asyncts.c @@ -116,6 +116,12 @@ static int config_props(AVFilterLink *link) return 0; } +/* get amount of data currently buffered, in samples */ +static int64_t get_delay(ASyncContext *s) +{ + return avresample_available(s->avr) + avresample_get_delay(s->avr); +} + static int request_frame(AVFilterLink *link) { AVFilterContext *ctx = link->src; @@ -128,7 +134,7 @@ static int request_frame(AVFilterLink *link) ret = ff_request_frame(ctx->inputs[0]); /* flush the fifo */ - if (ret == AVERROR_EOF && (nb_samples = avresample_get_delay(s->avr))) { + if (ret == AVERROR_EOF && (nb_samples = get_delay(s))) { AVFilterBufferRef *buf = ff_get_audio_buffer(link, AV_PERM_WRITE, nb_samples); if (!buf) @@ -155,12 +161,6 @@ static int write_to_fifo(ASyncContext *s, AVFilterBufferRef *buf) return ret; } -/* get amount of data currently buffered, in samples */ -static int64_t get_delay(ASyncContext *s) -{ - return avresample_available(s->avr) + avresample_get_delay(s->avr); -} - static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf) { AVFilterContext *ctx = inlink->dst; From 8083332c2de9ee189f96844ff4c2d9be1844116f Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 12 Dec 2012 13:26:57 -0500 Subject: [PATCH 3/3] asyncts: use clipped delta value when setting resample compensation The max_comp option is supposed to limit maximum compensation, but currently the clipped value is not actually used. --- libavfilter/af_asyncts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c index 67f3c4fdde..087692e0d6 100644 --- a/libavfilter/af_asyncts.c +++ b/libavfilter/af_asyncts.c @@ -197,7 +197,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *buf) if (s->resample) { int comp = av_clip(delta, -s->max_comp, s->max_comp); av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp); - avresample_set_compensation(s->avr, delta, inlink->sample_rate); + avresample_set_compensation(s->avr, comp, inlink->sample_rate); } delta = 0; }