mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-29 12:25:37 +00:00
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.
This commit is contained in:
parent
889fac3823
commit
1364070eca
1 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue