textrender: Negotiate caps on a GAP event if none were negotiated yet

Otherwise downstream wouldn't have received a segment event either and
wouldn't know what to do with the gap event

And also forward any pending segment event.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3541>
This commit is contained in:
Sebastian Dröge 2022-12-07 14:49:05 +02:00 committed by GStreamer Marge Bot
parent 02359dd251
commit 010ede30dd

View file

@ -650,6 +650,25 @@ gst_text_render_event (GstPad * pad, GstObject * parent, GstEvent * event)
break;
}
case GST_EVENT_GAP:
/* Negotiate caps first if we negotiated none so far as otherwise
* downstream wouldn't have received a segment event either and
* wouldn't know what to do with the gap event */
if (!gst_pad_has_current_caps (render->srcpad)) {
if (gst_text_render_renegotiate (render) != GST_FLOW_OK) {
gst_event_unref (event);
ret = FALSE;
break;
}
}
if (render->segment_event) {
gst_pad_push_event (render->srcpad, render->segment_event);
render->segment_event = NULL;
}
ret = gst_pad_event_default (pad, parent, event);
break;
default:
ret = gst_pad_event_default (pad, parent, event);
break;