diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-06-19 20:29:57 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-06-26 19:07:29 +0200 |
commit | a5b929026100b7508d8fee6dbbea42f3a5db05fc (patch) | |
tree | 83af963875310650db111068102b21fc692e016f /video/decode/vd_lavc.c | |
parent | eb4da3400a1c37eea7b258b00297e8b8fcdd8db4 (diff) | |
download | mpv-a5b929026100b7508d8fee6dbbea42f3a5db05fc.tar.bz2 mpv-a5b929026100b7508d8fee6dbbea42f3a5db05fc.tar.xz |
vd_lavc: check if av_device_ref is available
Fixes crashes when hwdevice failed to create.
Fixes: #11769
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r-- | video/decode/vd_lavc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 020ae6a991..a39a37aad3 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -449,7 +449,9 @@ static AVBufferRef *hwdec_create_dev(struct mp_filter *vd, const struct mp_hwdec_ctx *hw_ctx = hwdec_devices_get_by_imgfmt(ctx->hwdec_devs, imgfmt); - return hw_ctx ? av_buffer_ref(hw_ctx->av_device_ref) : NULL; + + if (hw_ctx && hw_ctx->av_device_ref) + return av_buffer_ref(hw_ctx->av_device_ref); } return NULL; |