summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2016-05-06 12:26:55 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2016-05-10 09:26:17 -0400
commit531ff7161d9d6b0cf8f71125319c1f5df5041637 (patch)
tree7ba275b5e23afc0e39c27c94afe6526ff2e47e67 /libavfilter
parent356c116536650ae015f914fda060203dd853cc5c (diff)
vf_colorspace: don't enable passthrough if bitdepth doesn't match.
Also check return value of av_frame_copy() in passthrough mode, so that if a copy fails (as it did here, because bitdepth didn't match), the filter doesn't return success, which would mean sending an uninitialized framebuffer further down the filtergraph.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_colorspace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
index 3f299a7247..3d39f13d1e 100644
--- a/libavfilter/vf_colorspace.c
+++ b/libavfilter/vf_colorspace.c
@@ -719,7 +719,8 @@ static int create_filtergraph(AVFilterContext *ctx,
s->yuv2yuv_fastmode = s->rgb2rgb_passthrough && fmt_identical;
s->yuv2yuv_passthrough = s->yuv2yuv_fastmode && s->in_rng == s->out_rng &&
!memcmp(s->in_lumacoef, s->out_lumacoef,
- sizeof(*s->in_lumacoef));
+ sizeof(*s->in_lumacoef)) &&
+ in_desc->comp[0].depth == out_desc->comp[0].depth;
if (!s->yuv2yuv_passthrough) {
if (redo_yuv2rgb) {
double rgb2yuv[3][3], (*yuv2rgb)[3] = s->yuv2rgb_dbl_coeffs;
@@ -937,7 +938,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
td.in_ss_h = av_pix_fmt_desc_get(in->format)->log2_chroma_h;
td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h;
if (s->yuv2yuv_passthrough) {
- av_frame_copy(out, in);
+ res = av_frame_copy(out, in);
+ if (res < 0)
+ return res;
} else {
ctx->internal->execute(ctx, convert, &td, NULL,
FFMIN((in->height + 1) >> 1, ctx->graph->nb_threads));