summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-23 21:41:54 +0200
committerwm4 <wm4@nowhere>2015-08-23 21:41:54 +0200
commit3bbcbc15a5be6f174baf5783785c8d070fa037cf (patch)
treeda133bbe01238b79aa60dd4a6575dc8b38e083d2
parent63dc0085c8c6c543e21e279751a00376793efaf4 (diff)
downloadmpv-3bbcbc15a5be6f174baf5783785c8d070fa037cf.tar.bz2
mpv-3bbcbc15a5be6f174baf5783785c8d070fa037cf.tar.xz
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.
-rw-r--r--video/out/gl_hwdec_vda.c4
1 files changed, 4 insertions, 0 deletions
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);