From: Gwenole Beauchesne Date: Mon, 28 Jul 2014 08:09:34 +0000 (+0200) Subject: vaapisink: always keep the last displayed buffer around. X-Git-Tag: 1.19.3~503^2~2053 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a26df804a6140be72fe9b75533530171235b7b6d;p=platform%2Fupstream%2Fgstreamer.git 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". --- diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index 8225fda..61d92ac 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -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;