summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2020-01-14 11:17:49 -0800
committerU. Artie Eoff <ullysses.a.eoff@intel.com>2020-01-14 11:37:22 -0800
commit1364070eca040306ea42bfdd59d09c80022d166a (patch)
treeabe956d070104dc391ee74aedfe010ebd8315b90
parent889fac3823cc4f6ab5923a71d3e56d25f17df52e (diff)
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.
-rw-r--r--gst/vaapi/gstvaapioverlay.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gst/vaapi/gstvaapioverlay.c b/gst/vaapi/gstvaapioverlay.c
index 7cdb21eb..53efdace 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);