Unified · Split
| @@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, · 82 unmodified lines | ||
| 83 | 83 | uint32_t width = (avctx->coded_width + 1) & ~1; |
| 84 | 84 | uint32_t height = (avctx->coded_height + 3) & ~3; |
| 85 | 85 | |
| 86 | + if (!hwctx) { | |
| 87 | + vdctx->device = VDP_INVALID_HANDLE; | |
| 88 | + av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n"); | |
| 89 | + return 0; | |
| 90 | + } | |
| 91 | + | |
| 86 | 92 | if (hwctx->context.decoder != VDP_INVALID_HANDLE) { |
| 87 | 93 | vdctx->decoder = hwctx->context.decoder; |
| 88 | 94 | vdctx->render = hwctx->context.render; |