[pulseaudio-discuss] [PATCH v6 08/37] rtp: Introduce pa_rtsp_exec_ready()

Hajime Fujita crisp.fujita at gmail.com
Sun Jan 31 20:16:05 PST 2016

From: Hajime Fujita <crisp.fujita at nifty.com>

In the current RTSP implementation, there is a vulnerable window
between the RTSP object creation and the URL initialization.
If any RTSP command is issued during this period, it will lead to
crash by assertion violation.

This patch introduces pa_rtsp_exec_ready(), which returns if it is
safe to issue RTSP commands.
 src/modules/rtp/rtsp_client.c | 6 ++++++
 src/modules/rtp/rtsp_client.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 6e65860..198417e 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -389,6 +389,12 @@ void pa_rtsp_remove_header(pa_rtsp_client *c, const char *key) {
     pa_headerlist_remove(c->headers, key);
+bool pa_rtsp_exec_ready(const pa_rtsp_client *c) {
+    pa_assert(c);
+    return c->url != NULL && c->ioline != NULL;
 static int rtsp_exec(pa_rtsp_client *c, const char *cmd,
                         const char *content_type, const char *content,
                         int expect_response,
diff --git a/src/modules/rtp/rtsp_client.h b/src/modules/rtp/rtsp_client.h
index 7e9978d..abc60ee 100644
--- a/src/modules/rtp/rtsp_client.h
+++ b/src/modules/rtp/rtsp_client.h
@@ -58,6 +58,8 @@ void pa_rtsp_set_url(pa_rtsp_client *c, const char *url);
 void pa_rtsp_add_header(pa_rtsp_client *c, const char *key, const char *value);
 void pa_rtsp_remove_header(pa_rtsp_client *c, const char *key);
+bool pa_rtsp_exec_ready(const pa_rtsp_client *c);
 int pa_rtsp_options(pa_rtsp_client *c);
 int pa_rtsp_announce(pa_rtsp_client *c, const char *sdp);

More information about the pulseaudio-discuss mailing list