summaryrefslogtreecommitdiffstats
path: root/src/modules/rtp
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-03-02 14:08:11 +0100
committerLennart Poettering <lennart@poettering.net>2009-03-02 14:08:11 +0100
commit77514c1c4cfd4154371fb7b745772a02c5932ec2 (patch)
tree6c54fab0c0e7c8921781d1bb2b8b5ddf210a9016 /src/modules/rtp
parent5c514aaacc5f90a7bf9a3536ef5d3aefaad1c55c (diff)
parent8a00c009439d1c559a2992b2f9f67e2708334d5a (diff)
Merge commit 'coling/master'
Diffstat (limited to 'src/modules/rtp')
-rw-r--r--src/modules/rtp/rtsp_client.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 9eb3d964..3b077bec 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -101,26 +101,27 @@ pa_rtsp_client* pa_rtsp_client_new(pa_mainloop_api *mainloop, const char* hostna
void pa_rtsp_client_free(pa_rtsp_client* c) {
- if (c) {
- if (c->sc)
- pa_socket_client_unref(c->sc);
- if (c->ioline)
- pa_ioline_close(c->ioline);
- else if (c->io)
- pa_iochannel_free(c->io);
-
- pa_xfree(c->hostname);
- pa_xfree(c->url);
- pa_xfree(c->localip);
- pa_xfree(c->session);
- pa_xfree(c->transport);
- pa_xfree(c->last_header);
- if (c->header_buffer)
- pa_strbuf_free(c->header_buffer);
- if (c->response_headers)
- pa_headerlist_free(c->response_headers);
- pa_headerlist_free(c->headers);
- }
+ pa_assert(c);
+
+ if (c->sc)
+ pa_socket_client_unref(c->sc);
+ if (c->ioline)
+ pa_ioline_close(c->ioline);
+ else if (c->io)
+ pa_iochannel_free(c->io);
+
+ pa_xfree(c->hostname);
+ pa_xfree(c->url);
+ pa_xfree(c->localip);
+ pa_xfree(c->session);
+ pa_xfree(c->transport);
+ pa_xfree(c->last_header);
+ if (c->header_buffer)
+ pa_strbuf_free(c->header_buffer);
+ if (c->response_headers)
+ pa_headerlist_free(c->response_headers);
+ pa_headerlist_free(c->headers);
+
pa_xfree(c);
}
@@ -141,8 +142,6 @@ static void headers_read(pa_rtsp_client *c) {
c->transport = pa_xstrdup(pa_headerlist_gets(c->response_headers, "Transport"));
if (!c->session || !c->transport) {
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
pa_log("Invalid SETUP response.");
return;
}
@@ -160,8 +159,6 @@ static void headers_read(pa_rtsp_client *c) {
}
if (0 == c->rtp_port) {
/* Error no server_port in response */
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
pa_log("Invalid SETUP response (no port number).");
return;
}
@@ -169,9 +166,6 @@ static void headers_read(pa_rtsp_client *c) {
/* Call our callback */
c->callback(c, c->state, c->response_headers, c->userdata);
-
- pa_headerlist_free(c->response_headers);
- c->response_headers = NULL;
}
@@ -201,7 +195,8 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
}
if (c->waiting && 0 == strcmp("RTSP/1.0 200 OK", s2)) {
c->waiting = 0;
- pa_assert(!c->response_headers);
+ if (c->response_headers)
+ pa_headerlist_free(c->response_headers);
c->response_headers = pa_headerlist_new();
goto exit;
}
@@ -353,9 +348,12 @@ void pa_rtsp_set_callback(pa_rtsp_client *c, pa_rtsp_cb_t callback, void *userda
void pa_rtsp_disconnect(pa_rtsp_client *c) {
pa_assert(c);
- if (c->io)
+ if (c->ioline)
+ pa_ioline_close(c->ioline);
+ else if (c->io)
pa_iochannel_free(c->io);
c->io = NULL;
+ c->ioline = NULL;
}