vaapisink: always keep the last displayed buffer around.

Always record the VA surface that is currently being rendered, no matter
the fact we are using texturedblit or overlay. That's because in some
occasions, we need to refresh or resize the displayed contents based on
new events. e.g. user-resized window.

Besides, it's simpler to track the last video buffer in GstVaapiSink than
through the base sink "last-sample".
This commit is contained in:
Gwenole Beauchesne 2014-07-28 10:09:34 +02:00
parent 5ffa82b64c
commit a26df804a6

View file

@ -211,26 +211,10 @@ static void
gst_vaapisink_video_overlay_expose(GstVideoOverlay *overlay)
{
GstVaapiSink * const sink = GST_VAAPISINK(overlay);
GstBaseSink * const base_sink = GST_BASE_SINK(overlay);
GstBuffer *buffer;
if (sink->use_overlay)
buffer = sink->video_buffer ? gst_buffer_ref(sink->video_buffer) : NULL;
else {
#if GST_CHECK_VERSION(1,0,0)
GstSample * const sample = gst_base_sink_get_last_sample(base_sink);
if (!sample)
return;
buffer = gst_buffer_ref(gst_sample_get_buffer(sample));
gst_sample_unref(sample);
#else
buffer = gst_base_sink_get_last_buffer(base_sink);
#endif
}
if (buffer) {
gst_vaapisink_show_frame(base_sink, buffer);
gst_buffer_unref(buffer);
}
if (sink->video_buffer)
gst_vaapisink_show_frame(GST_BASE_SINK_CAST(sink),
gst_buffer_ref(sink->video_buffer));
}
static void
@ -1075,8 +1059,7 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
goto error;
/* Retain VA surface until the next one is displayed */
if (sink->use_overlay)
gst_buffer_replace(&sink->video_buffer, buffer);
gst_buffer_replace(&sink->video_buffer, buffer);
gst_buffer_unref(buffer);
return GST_FLOW_OK;