mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 12:41:05 +00:00
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:
parent
5ffa82b64c
commit
a26df804a6
1 changed files with 4 additions and 21 deletions
|
@ -211,26 +211,10 @@ static void
|
||||||
gst_vaapisink_video_overlay_expose(GstVideoOverlay *overlay)
|
gst_vaapisink_video_overlay_expose(GstVideoOverlay *overlay)
|
||||||
{
|
{
|
||||||
GstVaapiSink * const sink = GST_VAAPISINK(overlay);
|
GstVaapiSink * const sink = GST_VAAPISINK(overlay);
|
||||||
GstBaseSink * const base_sink = GST_BASE_SINK(overlay);
|
|
||||||
GstBuffer *buffer;
|
|
||||||
|
|
||||||
if (sink->use_overlay)
|
if (sink->video_buffer)
|
||||||
buffer = sink->video_buffer ? gst_buffer_ref(sink->video_buffer) : NULL;
|
gst_vaapisink_show_frame(GST_BASE_SINK_CAST(sink),
|
||||||
else {
|
gst_buffer_ref(sink->video_buffer));
|
||||||
#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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1075,7 +1059,6 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *src_buffer)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Retain VA surface until the next one is displayed */
|
/* 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);
|
gst_buffer_unref(buffer);
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
Loading…
Reference in a new issue