summaryrefslogtreecommitdiff
path: root/libavcodec/vdpau_vc1.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-09-28 11:13:35 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-10-02 20:51:14 +0200
commitaf6e232ccf8db2341361f02852017aac48772950 (patch)
treec2308a65a789f6311281dd7a1f4c703e7d87c7b6 /libavcodec/vdpau_vc1.c
parentebb8dd437b7d6f88611b3e4cc00ff035297d685c (diff)
downloadffmpeg-af6e232ccf8db2341361f02852017aac48772950.tar.gz
VC1 VDPAU: Mark missing reference frames as such.
Currently the code passes some nonsense values as references instead, causing corruption with NVidia's and assertion failures with Mesa's implementation. For non-corrupted input this mostly happens in interlaced bitstreams, e.g. http://samples.mplayerhq.hu/V-codecs/WMV9/interlaced/480i30__codec_WVC1__mode_2__framerate_29.970__type_2__preproc_17.wmv. The != VDP_INVALID handle assert does not trigger (and probably is quite nonsense) because the frames are initialized to 0. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/vdpau_vc1.c')
-rw-r--r--libavcodec/vdpau_vc1.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/vdpau_vc1.c b/libavcodec/vdpau_vc1.c
index 272b2d9d94..c6e3343460 100644
--- a/libavcodec/vdpau_vc1.c
+++ b/libavcodec/vdpau_vc1.c
@@ -44,14 +44,18 @@ static int vdpau_vc1_start_frame(AVCodecContext *avctx,
switch (s->pict_type) {
case AV_PICTURE_TYPE_B:
+ if (s->next_picture_ptr) {
ref = ff_vdpau_get_surface_id(&s->next_picture);
assert(ref != VDP_INVALID_HANDLE);
info->backward_reference = ref;
+ }
/* fall-through */
case AV_PICTURE_TYPE_P:
+ if (s->last_picture_ptr) {
ref = ff_vdpau_get_surface_id(&s->last_picture);
assert(ref != VDP_INVALID_HANDLE);
info->forward_reference = ref;
+ }
}
info->slice_count = 0;