proper way to change element's caps in pipeline on runtime
Byunghun Lee
byunghun.lee at fainders.ai
Thu Apr 7 05:33:11 UTC 2022
Hi dev.
Now I'm trying to change framerate of rtsp stream on runtime.
My test pipeline is like below.
rtspsrc ! depayloader ! decoder ! videorate ! video/x-raw,framerate=15/1 !
f.sink_1 \
rtspsrc ! depayloader ! decoder ! videorate ! video/x-raw,framerate=15/1 !
f.sink_2 \
funnel name=f ! videoscale ! videoconvert !
video/x-raw,width=640,height=384,format=RGB ! tensor_converter ! fakesink
After running pipeline 20sec,
I changed two capsfilter "video/x-raw,framerate=15/1" to
"video/x-raw,framerate=1/1".
Other elements reconfigured well after changing capsfilter, But the third
party plugin element "tensor_converter" doesn't perform reconfiguring
process.
By tracing logs of tensor_conveter, I saw that tensor_converter get
sink_query from capsfilter as framerate 1/1 but, cannot make any
intersected caps.
below lines are part of source code of tensor_converter.
```
static GstCaps *
gst_tensor_converter_query_caps (GstTensorConverter * self, GstPad * pad,
GstCaps * filter)
{
GstCaps *caps;
caps = gst_pad_get_current_caps (pad);
if (!caps) {
caps = gst_pad_get_pad_template_caps (pad);
}
if (pad == self->sinkpad) {
GstCaps *media_caps;
media_caps = gst_tensor_converter_get_possible_media_caps (self);
if (media_caps) {
/* intersect with pad caps */
GstCaps *tmp = gst_caps_intersect_full (media_caps, caps,
GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
caps = tmp;
gst_caps_unref (media_caps);
}
}
silent_debug_caps (self, caps, "caps");
silent_debug_caps (self, filter, "filter");
if (filter) {
GstCaps *intersection;
intersection =
gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
caps = intersection;
}
silent_debug_caps (self, caps, "result");
return caps;
}
```
log says caps = gst_pad_get_current_caps (pad); return old caps
and media_caps = NULL, filter = new_caps
and then gst_caps_intersect_full return EMPTY.
So I wonder what should I do to change caps.
And Is there any other examples of caps negotiation?
I'm trying to trace negotiation call stacks but It little bit confusing me.
Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220407/ccc882c2/attachment.htm>
More information about the gstreamer-devel
mailing list