From 3bbcbc15a5be6f174baf5783785c8d070fa037cf Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Aug 2015 21:41:54 +0200 Subject: vda, videotoolbox: guard against unexpected pixel format Should not happen, but since we don't control decoder video surface allocation, anything could happen, and the code should be able to deal with it. Untested. --- video/out/gl_hwdec_vda.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'video') diff --git a/video/out/gl_hwdec_vda.c b/video/out/gl_hwdec_vda.c index c257781885..4ec46671a4 100644 --- a/video/out/gl_hwdec_vda.c +++ b/video/out/gl_hwdec_vda.c @@ -96,6 +96,10 @@ static struct mp_image *download_image(struct mp_hwdec_ctx *ctx, size_t height = CVPixelBufferGetHeight(pbuf); uint32_t cvpixfmt = CVPixelBufferGetPixelFormatType(pbuf); struct vda_format *f = vda_get_gl_format(cvpixfmt); + if (!f) { + CVPixelBufferUnlockBaseAddress(pbuf, 0); + return NULL; + } struct mp_image img = {0}; mp_image_setfmt(&img, f->imgfmt); -- cgit v1.2.3