summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-24 16:30:33 +0300
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-29 12:05:00 +0200
commite36fb69ef907333fce851ff6bb644ea3b5b0b165 (patch)
treef416dce425effd79a24dd0cdb32b6d5adef1b52c
parentab8b0359e16107d59d3f216688e4e86a4aeb6eea (diff)
vaapisink: retain VA surface until another one is displayed.
Keep VA surface proxy associated with the surface that is currently being displayed. This makes sure that surface is not released back to the pool of surfaces free to use for decoding. This is necessary with VA driver implementations that support rendering to an overlay pipe. Otherwise, there could be cases where we are decoding into a surface that is being displayed, hence some flickering.
-rw-r--r--gst/vaapi/gstvaapisink.c10
-rw-r--r--gst/vaapi/gstvaapisink.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c
index 4611974..cacf087 100644
--- a/gst/vaapi/gstvaapisink.c
+++ b/gst/vaapi/gstvaapisink.c
@@ -223,6 +223,7 @@ gst_vaapisink_xoverlay_iface_init(GstXOverlayClass *iface)
static void
gst_vaapisink_destroy(GstVaapiSink *sink)
{
+ gst_buffer_replace(&sink->video_buffer, NULL);
g_clear_object(&sink->texture);
g_clear_object(&sink->display);
@@ -468,6 +469,7 @@ gst_vaapisink_stop(GstBaseSink *base_sink)
{
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
+ gst_buffer_replace(&sink->video_buffer, NULL);
g_clear_object(&sink->window);
g_clear_object(&sink->display);
@@ -772,7 +774,12 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
success = FALSE;
break;
}
- return success ? GST_FLOW_OK : GST_FLOW_UNEXPECTED;
+ if (!success)
+ return GST_FLOW_UNEXPECTED;
+
+ /* Retain VA surface until the next one is displayed */
+ gst_buffer_replace(&sink->video_buffer, buffer);
+ return GST_FLOW_OK;
}
static gboolean
@@ -938,6 +945,7 @@ gst_vaapisink_init(GstVaapiSink *sink)
sink->window_width = 0;
sink->window_height = 0;
sink->texture = NULL;
+ sink->video_buffer = NULL;
sink->video_width = 0;
sink->video_height = 0;
sink->video_par_n = 1;
diff --git a/gst/vaapi/gstvaapisink.h b/gst/vaapi/gstvaapisink.h
index 5493046..0e8709f 100644
--- a/gst/vaapi/gstvaapisink.h
+++ b/gst/vaapi/gstvaapisink.h
@@ -74,6 +74,7 @@ struct _GstVaapiSink {
guint window_width;
guint window_height;
GstVaapiTexture *texture;
+ GstBuffer *video_buffer;
guint video_width;
guint video_height;
gint video_par_n;