History

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

Michael Niedermayer committed 12 years ago

Commit ec6a8551 parent 0ba887b1 file · +6 −0Browse files

Unified · Split

libavcodec/vdpau.c+6−0
@@ -83,6 +83,12 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, · 82 unmodified lines
8383 uint32_t width = (avctx->coded_width + 1) & ~1;
8484 uint32_t height = (avctx->coded_height + 3) & ~3;
8585
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+
8692 if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
8793 vdctx->decoder = hwctx->context.decoder;
8894 vdctx->render = hwctx->context.render;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t