From: U. Artie Eoff Date: Tue, 14 Jan 2020 19:17:49 +0000 (-0800) Subject: vaapioverlay: ensure sinkpad has current buffer X-Git-Tag: 1.19.3~503^2~307 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1364070eca040306ea42bfdd59d09c80022d166a;p=platform%2Fupstream%2Fgstreamer.git vaapioverlay: ensure sinkpad has current buffer Use the gst_video_aggregator_pad_has_current_buffer API to check if the current sinkpad has a queued buffer before attempting to obtain a input buffer from the base plugin. If the sinkpad does not have a current buffer, then it is either not producing them yet (e.g. current time < sinkpad start time) or it has reached EOS. Previously, we only handled EOS case. Example: gst-launch-1.0 videotestsrc num-buffers=100 \ ! vaapipostproc ! vaapioverlay name=overlay \ ! vaapisink videotestsrc timestamp-offset=1000000000 \ num-buffers=100 ! video/x-raw,width=160,height=120 \ ! overlay. --- diff --git a/gst/vaapi/gstvaapioverlay.c b/gst/vaapi/gstvaapioverlay.c index 7cdb21e..53efdac 100644 --- a/gst/vaapi/gstvaapioverlay.c +++ b/gst/vaapi/gstvaapioverlay.c @@ -385,6 +385,11 @@ gst_vaapi_overlay_surface_next (gpointer data) blend_surface = &generator->blend_surface; blend_surface->surface = NULL; + /* Current sinkpad may not be queueing buffers yet (e.g. timestamp-offset) + * or it may have reached EOS */ + if (!gst_video_aggregator_pad_has_current_buffer (vagg_pad)) + continue; + inframe = gst_video_aggregator_pad_get_prepared_frame (vagg_pad); buf = gst_video_aggregator_pad_get_current_buffer (vagg_pad); pad = GST_VAAPI_OVERLAY_SINK_PAD (vagg_pad); @@ -393,10 +398,6 @@ gst_vaapi_overlay_surface_next (gpointer data) (generator->overlay), GST_PAD (pad), buf, &inbuf) != GST_FLOW_OK) return blend_surface; - /* Current sinkpad may have reached EOS */ - if (!inframe || !inbuf) - continue; - inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf); if (inbuf_meta) { blend_surface->surface = gst_vaapi_video_meta_get_surface (inbuf_meta);