mirror of https://github.com/mpv-player/mpv
gl_video: use hwdec download_image call only if hwdec is active
The hwdec driver can be loaded, even if it's not used (e.g. when playing a file with no hardware decoding after one with it enabled). Also, check whether dlimage is NULL. Since this will do call into the native hwdec API, there's a chance a driver could fail doing this, it's better to check the return value, even if this case currently can't happen.
This commit is contained in:
parent
6fb020f5de
commit
391035d857
|
@ -1699,9 +1699,10 @@ struct mp_image *gl_video_download_image(struct gl_video *p)
|
|||
if (!p->have_image)
|
||||
return NULL;
|
||||
|
||||
if (p->hwdec && p->hwdec->driver->download_image) {
|
||||
if (p->hwdec_active && p->hwdec->driver->download_image) {
|
||||
struct mp_image *dlimage = p->hwdec->driver->download_image(p->hwdec);
|
||||
mp_image_set_attributes(dlimage, &p->image_params);
|
||||
if (dlimage)
|
||||
mp_image_set_attributes(dlimage, &p->image_params);
|
||||
return dlimage;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue