summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-01-26 15:19:14 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-01-27 13:28:12 +0100
commit2897618b852c0f8e25df40f8980e1c2c5c59653e (patch)
treec2bea26bc90460922d0558c0750640cb8549ec83 /gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
parent7b19745141d3d653e84e3512b7235292e7c1e17a (diff)
decoder: properly reference count pictures.
This fixes cases where a GstVaapiPicture would be destroyed whereas there is still a valid instance of it in either prev, current or next picture.
Diffstat (limited to 'gst-libs/gst/vaapi/gstvaapidecoder_vc1.c')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_vc1.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
index 9f4e6c9e..b305b28b 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_vc1.c
@@ -227,9 +227,8 @@ decode_current_picture(GstVaapiDecoderVC1 *decoder)
if (!GST_VAAPI_PICTURE_IS_REFERENCE(picture)) {
if (priv->prev_picture && priv->next_picture)
status = render_picture(decoder, picture);
- gst_vaapi_picture_unref(picture);
}
- priv->current_picture = NULL;
+ gst_vaapi_picture_replace(&priv->current_picture, NULL);
}
return status;
}
@@ -957,16 +956,10 @@ decode_frame(GstVaapiDecoderVC1 *decoder, GstVC1BDU *rbdu, GstVC1BDU *ebdu)
/* Update reference pictures */
if (GST_VAAPI_PICTURE_IS_REFERENCE(picture)) {
- if (priv->prev_picture) {
- gst_vaapi_picture_unref(priv->prev_picture);
- priv->prev_picture = NULL;
- }
- if (priv->next_picture) {
- priv->prev_picture = priv->next_picture;
- priv->next_picture = NULL;
- status = render_picture(decoder, priv->prev_picture);
- }
- priv->next_picture = picture;
+ if (priv->next_picture)
+ status = render_picture(decoder, priv->next_picture);
+ gst_vaapi_picture_replace(&priv->prev_picture, priv->next_picture);
+ gst_vaapi_picture_replace(&priv->next_picture, picture);
}
if (!fill_picture(decoder, picture))