mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 23:28:16 +00:00
vaapisink: optimize GstVideoOverlayInterface::expose().
When render-mode is "overlay", then it is not really useful to peek into the GstBaseSink::last_buffer, since we have our own video_buffer already recorded and maintained into GstVaapiSink.
This commit is contained in:
parent
ca0e77756b
commit
ad56d80c9e
1 changed files with 11 additions and 6 deletions
|
@ -218,18 +218,23 @@ gst_vaapisink_video_overlay_set_render_rectangle(
|
|||
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);
|
||||
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);
|
||||
buffer = gst_base_sink_get_last_buffer(base_sink);
|
||||
#endif
|
||||
}
|
||||
if (buffer) {
|
||||
gst_vaapisink_show_frame(base_sink, buffer);
|
||||
gst_buffer_unref(buffer);
|
||||
|
|
Loading…
Reference in a new issue