gst-rtsp-server: different media will be created for URL rtsp://<IP>:<PORT> and URL rtsp://<IP>:<PORT>/
Hi,
I'm using gstreamer 1.20.2 and come across a problem about mount point "/".
When using shared media factory and mount it at mount point "/", the factory can be accessed by both the URL forms rtsp://<IP>:<PORT>
and rtsp://<IP>:<PORT>/
.
But I found that the media created by the factory can't be shared between the 2 URL forms.
After the media is created by accessing URL rtsp://<IP>:<PORT>/
, accessing URL rtsp://<IP>:<PORT>
will match the same factory but create another new media.
The result of accessing URL rtsp://<IP>:<PORT>
first and then accessing URL rtsp://<IP>:<PORT>/
is the same, 2 media created while factory is shared.
After investigation, I found that:
When DESCRIBE request is handled for an URL, the default_make_path() will normalize URL rtsp://<IP>:<PORT>
to rtsp://<IP>:<PORT>/
to generate path.
And the path is passed to find_media().
According to my understanding, if the media factory is shared and is attached to mount point "/", the media should be shared for both URL forms.
The default_gen_key() is used to generated key for caching media in gst_rtsp_media_factory_construct(). However, the key is generated by the following line in default_gen_key():
result = g_strdup_printf ("%u%s%s%s", port, url->abspath, pre_query, query);
url->abspath is not normalized, so the key will be different and therefore different media will be created for URL rtsp://<IP>:<PORT>
and URL rtsp://<IP>:<PORT>/
.
According to my understanding, the possible solution to this situation might be the url could either be normalized before it is passed to gst_rtsp_media_factory_construct() or be normalized in default_gen_key() directly. Would you please help to take a look and advise the next step? Thank you.
related commit gst-rtsp-server@e9555d15