Default implementation of GstRTSPServer.create_client performs a lot more than creating the client
It was suggested in bug #134 to split this out into a separate bug report.
If I want to use a subclass of
GstRTSPClient in my app (e.g. to override some of its virtual methods), then I'll need a subclass of
GstRTSPServer that overrides
create_client to return my client subclass.
However, the default implementation of that virtual method does substantially more than just creating a
GstRTSPClient instance. It performs a bunch of additional initialisation to plumb the client object into the session pool, URI routing, etc. Further more, it does it while holding a private lock to ensure it gets a consistent version of all this state, which is not possible to do in a subclass.
Further more, the actual setup performed is not well defined and seems like it could easily change from release to release. Even within the library there's evidence of this kind of skew, with
GstRTSPOnvifServer not calling
gst_rtsp_client_set_content_length_limit on the clients it creates.
Two possible ways to improve this situation are:
add a new virtual method to
GstRTSPServerthat is responsibly for creating the client instance without the additional setup. The default
create_clientimplementation would call this new virtual method to create the client, and then perform the additional setup as before.
add a property (possibly a construct property?) to
GstRTSPServerspecifying the GType for client objects created by the server. The default
create_clientimplementation would use
g_object_new(client_type, NULL)to create the client object.