KSVideosrc: Application crash when using with capsfilter
I am using Windows 10 and Gstreamer 1.20.3. I have created an application that uses USB-Cameras as Input and until today I used mfvideosrc. But the problem with mfvideosrc is that it takes very long to restart the pipeline. Up to 2 seconds. So I wanted to use kfvideosrc which is faster.
So I have a running setup with mfvideosrc that works without problems. But if I replace mfvideosrc with ksvideosrc there are several problems.
I use GstDeviceMonitor to fetch the correct video formats for one camera. and with mfvideosrc I can select and use all of them. If I want to change the resolution for the ksvideosrc I get 1-2 working profils and the rest does not work. At least I get an error: streaming stopped, reason not-negotiated (-4) or the application crashes in gstwinks.dll.
So I have a pipeline with ksvideosrc and capsfilter To change the resolution i set the pipeline state from playing to ready then I set the format restriction in capsfilter. The format is probably a wrong one. And after that I set the pipeline state to playing. -> the result is a crash in gstksvideodevice.c "priv->request_events" was "nullptr".
Now if I change this a little bit like set pipeline state to ready but also set ksvideosrc state to null after that I set the videoformat in capsfilter and then I set the pipeline and the ksvideosrc state to playing -> now the result is an error in the debug log -> error: streaming stopped, reason not-negotiated (-4)
So there are 2 Problems The first is that the ksvideosrc has other videoformats than the gstdevicemonitor and some formats do not work even if they are supported like 4096 x 2160 and the second problem is that I can not restart the ksvideosrc through the pipeline if there is a specific capsfilter set. I think there is a problem with the negotiation process itself.
There is a third "problem", which isnt so important but maybe someone can explain this. For the device path I get different values: From gstdevicemonitor I get the devicepath with KSCATEGORY_VIDEO_CAMERA set. But Ksvideosrc wants the devicePath with KSCATEGORY_VIDEO set. And if I use the windows API directly I get the devicePath with KSCATEGORY_CAPTURE. Maybe it would be helpful if the ksvideosrc would accept all those GUIDs.