diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-05-20 15:57:30 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-05-20 15:57:30 +0200 |
commit | 5aa06b8058423e7ecd1f656d6d420cab6d581d1e (patch) | |
tree | d9fb8871d762295b56ce83f912bd8d04ee7d7fce | |
parent | 17322693f66a7e2b7b37f79a12618d6eea6e12cf (diff) |
client: store TCP ports in transport
Store the TCP ports in the transport when we are doing RTSP over TCP.
This way, we can easily get to the ports from the transport.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=729776
-rw-r--r-- | gst/rtsp-server/rtsp-client.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index d16eee0..fb44a29 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -1394,6 +1394,33 @@ default_configure_client_transport (GstRTSPClient * client, ct->destination = g_strdup (url->host); if (ct->lower_transport & GST_RTSP_LOWER_TRANS_TCP) { + GSocket *sock; + GSocketAddress *addr; + + sock = gst_rtsp_connection_get_read_socket (priv->connection); + if ((addr = g_socket_get_remote_address (sock, NULL))) { + /* our read port is the sender port of client */ + ct->client_port.min = + g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr)); + g_object_unref (addr); + } + if ((addr = g_socket_get_local_address (sock, NULL))) { + ct->server_port.max = + g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr)); + g_object_unref (addr); + } + sock = gst_rtsp_connection_get_write_socket (priv->connection); + if ((addr = g_socket_get_remote_address (sock, NULL))) { + /* our write port is the receiver port of client */ + ct->client_port.max = + g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr)); + g_object_unref (addr); + } + if ((addr = g_socket_get_local_address (sock, NULL))) { + ct->server_port.min = + g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (addr)); + g_object_unref (addr); + } /* check if the client selected channels for TCP */ if (ct->interleaved.min == -1 || ct->interleaved.max == -1) { gst_rtsp_session_media_alloc_channels (ctx->sessmedia, @@ -1449,6 +1476,8 @@ make_server_transport (GstRTSPClient * client, GstRTSPContext * ctx, break; case GST_RTSP_LOWER_TRANS_TCP: st->interleaved = ct->interleaved; + st->client_port = ct->client_port; + st->server_port = ct->server_port; default: break; } |