summaryrefslogtreecommitdiffstats
path: root/stream/librtsp/rtsp_session.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/librtsp/rtsp_session.c')
-rw-r--r--stream/librtsp/rtsp_session.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c
index a3559212b2..d999323fcd 100644
--- a/stream/librtsp/rtsp_session.c
+++ b/stream/librtsp/rtsp_session.c
@@ -31,12 +31,15 @@
#include <sys/types.h>
#include "config.h"
#ifndef HAVE_WINSOCK2
+#define closesocket close
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#else
#include <winsock2.h>
#endif
+
+
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
@@ -73,6 +76,29 @@ struct rtsp_session_s {
struct rtp_rtsp_session_t* rtp_session;
};
+/*
+ * closes an rtsp connection
+ */
+
+static void rtsp_close(rtsp_t *s) {
+
+ if (s->server_state)
+ {
+ if (s->server_state == RTSP_PLAYING)
+ rtsp_request_teardown (s, NULL);
+ closesocket (s->s);
+ }
+
+ if (s->path) free(s->path);
+ if (s->host) free(s->host);
+ if (s->mrl) free(s->mrl);
+ if (s->session) free(s->session);
+ if (s->user_agent) free(s->user_agent);
+ rtsp_free_answers(s);
+ rtsp_unschedule_all(s);
+ free(s);
+}
+
//rtsp_session_t *rtsp_session_start(char *mrl) {
rtsp_session_t *rtsp_session_start(int fd, char **mrl, char *path, char *host,
int port, int *redir, uint32_t bandwidth, char *user, char *pass) {