gst-rtsp-server should not port in internal media hash_table
Maurizio Galimberti
mgalimberti at marchnetworks.com
Fri Feb 1 13:39:30 UTC 2019
Hi all
We have an issue with gst-rtsp-server used with 2 parallel clients requesting two stream/connections to pipeline
first client requires RTP_TCP stream for example on 4444 server port
second client requires an RTSP_over_HTTP stream on the same 4444 server port
RtspServer pipeline is set in "shared" mode so second client should use always the unique instance of pipeline
What happens is that, when receiving first RTP_TCP connection all is ok because the url supplied is of the form
rtsp://10.31.7.78:4444/chan1
and like shown above this url has "port" explicitly declared
When receiving second RTSP_over_HTTP connection, the HTTP handshaking part is ok, but when start the tunnel
part in RTSP our url has not port declared in it because it is not necessary, like you see below
rtsp://10.31.7.78/chan1/
so port is not necessary because it has already been specified in the HTTP part of tunnel
At this point rtspServer internally decide to start a new rtsp-media with a new pipeline, and this is a big problem for our aims.
If we go to the source code we see that the second media/pipeline is started because in this source file
"../gst/rtsp-server/rtsp-media-factory.c"
there is the following code and in "default_gen_key()" function reported below ... you can see that "port" is used to
create key used in media hashTable, ....
So the question is: why is present "port" in default_gen_key() method ?
Could it be better to remove "port" from default_gen_key() method ?
The removal is because port was already read and used by rtspServer
Let's know
thankYou
Maurizio
1218 /* convert the url to a key for the hashtable. NULL return or a NULL function
1219 * will not cache anything for this factory. */
1220 if (klass->gen_key)
1221 key = klass->gen_key (factory, url); // <<<<<<<<<<<<<<<<<<<<<<
1222 else
1223 key = NULL;
1224
1225 g_mutex_lock (&priv->medias_lock);
1226 if (key) {
1227 /* we have a key, see if we find a cached media */
1228 media = g_hash_table_lookup (priv->medias, key); // <<<<<<<<<<<<<<<<<<<<<
1229 if (media)
1230 g_object_ref (media);
1231 } else
1232 media = NULL;
1233
static gchar *
default_gen_key (GstRTSPMediaFactory * factory, const GstRTSPUrl * url)
{
gchar *result;
const gchar *pre_query;
const gchar *query;
guint16 port;
pre_query = url->query ? "?" : "";
query = url->query ? url->query : "";
gst_rtsp_url_get_port (url, &port);
result = g_strdup_printf ("%u%s%s%s", port, url->abspath, pre_query, query); // <<<<<<<<<<<<<<<<<<<<
return result;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190201/fb494c98/attachment.html>
More information about the gstreamer-devel
mailing list