mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
63dc0085c8
commit
3bbcbc15a5
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue