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/3548>
This commit is contained in:
Sebastian Dröge 2022-12-07 14:49:05 +02:00 committed by Tim-Philipp Müller
parent 14f6dbc39a
commit c44ed8af36

View file

@ -650,6 +650,25 @@ gst_text_render_event (GstPad * pad, GstObject * parent, GstEvent * event)
break; 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: default:
ret = gst_pad_event_default (pad, parent, event); ret = gst_pad_event_default (pad, parent, event);
break; break;