From 6afa893c7f58ad3a511791ae1f55bca5584c3196 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 20 Dec 2019 15:00:05 +0100 Subject: [PATCH] wfd: Always touch session for incoming packets It turns out that some adapters (specifically MS v2 adapters) do not reply with the session ID for the keep-alive packet. In this case the gstreamer RTSP server will not automatically touch the GstRTSPSession and we will run into the session timeout. Fix this by simply touching all session for the client, for any received response. See: #20 --- src/wfd/wfd-client.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/wfd/wfd-client.c b/src/wfd/wfd-client.c index 38b385e..258d1d0 100644 --- a/src/wfd/wfd-client.c +++ b/src/wfd/wfd-client.c @@ -275,11 +275,31 @@ wfd_client_idle_set_params (gpointer user_data) return G_SOURCE_REMOVE; } +GstRTSPFilterResult +wfd_client_touch_session_filter_func (GstRTSPClient *client, + GstRTSPSession *sess, + gpointer user_data) +{ + gst_rtsp_session_touch (sess); + + return GST_RTSP_FILTER_KEEP; +} + void wfd_client_handle_response (GstRTSPClient * client, GstRTSPContext *ctx) { WfdClient *self = WFD_CLIENT (client); + /* Some sinks do not reply with the correct session-id. Which causes + * gst-rtsp-server to not touch the session, triggering a timeout + * even though the sink actually replied. + * + * Work around this by explicitly touching the session (again). And + * to do that, just touch all of them, which is acceptable as we will + * only have one. + */ + gst_rtsp_client_session_filter (client, wfd_client_touch_session_filter_func, NULL); + /* Track the initialization process and possibly trigger the * next state of the connection establishment. */ switch (self->init_state) -- 2.24.1