Browse Source

avcodec/vdpau: warn if the user application has not setup avctx->hwaccel_context instead of potentially crashing

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.5
Michael Niedermayer 11 years ago
parent
commit
ec6a855b3a
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/vdpau.c

+ 6
- 0
libavcodec/vdpau.c View File

@@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
uint32_t width = (avctx->coded_width + 1) & ~1; uint32_t width = (avctx->coded_width + 1) & ~1;
uint32_t height = (avctx->coded_height + 3) & ~3; uint32_t height = (avctx->coded_height + 3) & ~3;


if (!hwctx) {
vdctx->device = VDP_INVALID_HANDLE;
av_log(avctx, AV_LOG_WARNING, "hwaccel_context has not been setup by the user application, cannot initialize\n");
return 0;
}

if (hwctx->context.decoder != VDP_INVALID_HANDLE) { if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
vdctx->decoder = hwctx->context.decoder; vdctx->decoder = hwctx->context.decoder;
vdctx->render = hwctx->context.render; vdctx->render = hwctx->context.render;


Loading…
Cancel
Save