summaryrefslogtreecommitdiffstats
path: root/libavcodec/vdpau.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-06 14:10:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-06 14:10:37 +0200
commitec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80 (patch)
tree102f6edb0c0308d7ee3c9254125663db04d26ce0 /libavcodec/vdpau.c
parent0ba887bbf4d99b609247a5447dc63dc2e7550ff5 (diff)
downloadffmpeg-streaming-ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80.zip
ffmpeg-streaming-ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80.tar.gz
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>
Diffstat (limited to 'libavcodec/vdpau.c')
-rw-r--r--libavcodec/vdpau.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
index 3162814..f2b4acd 100644
--- a/libavcodec/vdpau.c
+++ b/libavcodec/vdpau.c
@@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
uint32_t width = (avctx->coded_width + 1) & ~1;
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) {
vdctx->decoder = hwctx->context.decoder;
vdctx->render = hwctx->context.render;
OpenPOWER on IntegriCloud