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

Michael Niedermayer git at videolan.org
Mon Oct 6 14:16:43 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct  6 14:10:37 2014 +0200| [ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80] | committer: Michael Niedermayer

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

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec6a855b3a6b87f3415cc4ecfc685bd2eefc6a80
---

 libavcodec/vdpau.c |    6 ++++++
 1 file changed, 6 insertions(+)

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;



More information about the ffmpeg-cvslog mailing list