mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-05 17:09:48 +00:00
gst/rtsp/: Add google RTSP extension, it can only handle udp and responds with unsupported if we do anything else. Fi...
Original commit message from CVS: * gst/rtsp/Makefile.am: * gst/rtsp/gstrtsp.c: (plugin_init): * gst/rtsp/gstrtspgoogle.c: (gst_rtsp_google_before_send), (gst_rtsp_google_after_send), (gst_rtsp_google_get_transports), (_do_init), (gst_rtsp_google_base_init), (gst_rtsp_google_class_init), (gst_rtsp_google_init), (gst_rtsp_google_finalize), (gst_rtsp_google_change_state), (gst_rtsp_google_extension_init): * gst/rtsp/gstrtspgoogle.h: Add google RTSP extension, it can only handle udp and responds with unsupported if we do anything else. Fixes #546465. * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_connection_send), (gst_rtspsrc_connection_receive), (gst_rtspsrc_loop_send_cmd), (gst_rtspsrc_create_transports_string), (gst_rtspsrc_setup_streams), (gst_rtspsrc_open), (gst_rtspsrc_close), (gst_rtspsrc_pause): Make transport setup code a bit better using GString. Add some more debug. Check for closed connections before doing anything on them.
This commit is contained in:
parent
4ab89b397e
commit
dd54e000ea
6 changed files with 340 additions and 28 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2008-08-20 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst/rtsp/Makefile.am:
|
||||||
|
* gst/rtsp/gstrtsp.c: (plugin_init):
|
||||||
|
* gst/rtsp/gstrtspgoogle.c: (gst_rtsp_google_before_send),
|
||||||
|
(gst_rtsp_google_after_send), (gst_rtsp_google_get_transports),
|
||||||
|
(_do_init), (gst_rtsp_google_base_init),
|
||||||
|
(gst_rtsp_google_class_init), (gst_rtsp_google_init),
|
||||||
|
(gst_rtsp_google_finalize), (gst_rtsp_google_change_state),
|
||||||
|
(gst_rtsp_google_extension_init):
|
||||||
|
* gst/rtsp/gstrtspgoogle.h:
|
||||||
|
Add google RTSP extension, it can only handle udp and responds with
|
||||||
|
unsupported if we do anything else. Fixes #546465.
|
||||||
|
|
||||||
|
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_connection_send),
|
||||||
|
(gst_rtspsrc_connection_receive), (gst_rtspsrc_loop_send_cmd),
|
||||||
|
(gst_rtspsrc_create_transports_string),
|
||||||
|
(gst_rtspsrc_setup_streams), (gst_rtspsrc_open),
|
||||||
|
(gst_rtspsrc_close), (gst_rtspsrc_pause):
|
||||||
|
Make transport setup code a bit better using GString.
|
||||||
|
Add some more debug.
|
||||||
|
Check for closed connections before doing anything on them.
|
||||||
|
|
||||||
2008-08-20 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2008-08-20 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
* ext/pulse/pulsesrc.c: (gst_pulsesrc_class_init),
|
* ext/pulse/pulsesrc.c: (gst_pulsesrc_class_init),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
plugin_LTLIBRARIES = libgstrtsp.la
|
plugin_LTLIBRARIES = libgstrtsp.la
|
||||||
|
|
||||||
libgstrtsp_la_SOURCES = gstrtsp.c gstrtspsrc.c \
|
libgstrtsp_la_SOURCES = gstrtsp.c gstrtspsrc.c \
|
||||||
gstrtpdec.c gstrtspext.c
|
gstrtpdec.c gstrtspext.c gstrtspgoogle.c
|
||||||
|
|
||||||
libgstrtsp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
libgstrtsp_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
||||||
libgstrtsp_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
|
libgstrtsp_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) \
|
||||||
|
@ -14,4 +14,5 @@ libgstrtsp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
noinst_HEADERS = gstrtspsrc.h \
|
noinst_HEADERS = gstrtspsrc.h \
|
||||||
gstrtsp.h \
|
gstrtsp.h \
|
||||||
gstrtpdec.h \
|
gstrtpdec.h \
|
||||||
gstrtspext.h
|
gstrtspext.h \
|
||||||
|
gstrtspgoogle.h
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
#include "gstrtpdec.h"
|
#include "gstrtpdec.h"
|
||||||
#include "gstrtspsrc.h"
|
#include "gstrtspsrc.h"
|
||||||
|
#include "gstrtspgoogle.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
|
@ -57,6 +58,10 @@ plugin_init (GstPlugin * plugin)
|
||||||
if (!gst_element_register (plugin, "rtpdec", GST_RANK_NONE, GST_TYPE_RTP_DEC))
|
if (!gst_element_register (plugin, "rtpdec", GST_RANK_NONE, GST_TYPE_RTP_DEC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (!gst_element_register (plugin, "rtspgoogle", GST_RANK_SECONDARY,
|
||||||
|
GST_TYPE_RTSP_GOOGLE)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
211
gst/rtsp/gstrtspgoogle.c
Normal file
211
gst/rtsp/gstrtspgoogle.c
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2008> Wim Taymans <wim.taymans@google.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
/* Element-Checklist-Version: 5 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:element-rtspgoogle
|
||||||
|
*
|
||||||
|
* A Google RTSP extension
|
||||||
|
*
|
||||||
|
* Last reviewed on 2008-08-20 (0.10.10)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <gst/rtsp/gstrtspextension.h>
|
||||||
|
|
||||||
|
#include "gstrtspgoogle.h"
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (rtspgoogle_debug);
|
||||||
|
#define GST_CAT_DEFAULT (rtspgoogle_debug)
|
||||||
|
|
||||||
|
/* elementfactory information */
|
||||||
|
static const GstElementDetails rtspgoogle_details =
|
||||||
|
GST_ELEMENT_DETAILS ("Google RTSP Extension",
|
||||||
|
"Network/Extension/Protocol",
|
||||||
|
"Extends RTSP so that it can handle Google setup",
|
||||||
|
"Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
|
#define SERVER_PREFIX "Google RTSP"
|
||||||
|
|
||||||
|
static GstRTSPResult
|
||||||
|
gst_rtsp_google_before_send (GstRTSPExtension * ext, GstRTSPMessage * request)
|
||||||
|
{
|
||||||
|
GstRTSPGoogle *ctx = (GstRTSPGoogle *) ext;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (ext, "before send");
|
||||||
|
|
||||||
|
switch (request->type_data.request.method) {
|
||||||
|
case GST_RTSP_OPTIONS:
|
||||||
|
{
|
||||||
|
/* activate ourselves with the first request */
|
||||||
|
ctx->active = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return GST_RTSP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstRTSPResult
|
||||||
|
gst_rtsp_google_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
|
||||||
|
GstRTSPMessage * resp)
|
||||||
|
{
|
||||||
|
GstRTSPGoogle *ctx = (GstRTSPGoogle *) ext;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (ext, "after send");
|
||||||
|
|
||||||
|
switch (req->type_data.request.method) {
|
||||||
|
case GST_RTSP_OPTIONS:
|
||||||
|
{
|
||||||
|
gchar *server = NULL;
|
||||||
|
|
||||||
|
gst_rtsp_message_get_header (resp, GST_RTSP_HDR_SERVER, &server, 0);
|
||||||
|
if (server && g_str_has_prefix (server, SERVER_PREFIX))
|
||||||
|
ctx->active = TRUE;
|
||||||
|
else
|
||||||
|
ctx->active = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return GST_RTSP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstRTSPResult
|
||||||
|
gst_rtsp_google_get_transports (GstRTSPExtension * ext,
|
||||||
|
GstRTSPLowerTrans protocols, gchar ** transport)
|
||||||
|
{
|
||||||
|
GstRTSPResult res;
|
||||||
|
GstRTSPGoogle *ctx = (GstRTSPGoogle *) ext;
|
||||||
|
GString *result;
|
||||||
|
|
||||||
|
if (!ctx->active)
|
||||||
|
return GST_RTSP_OK;
|
||||||
|
|
||||||
|
/* always only suggest UDP */
|
||||||
|
if (protocols & GST_RTSP_LOWER_TRANS_UDP) {
|
||||||
|
result = g_string_new ("");
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (ext, "adding UDP unicast");
|
||||||
|
|
||||||
|
g_string_append (result, "RTP/AVP");
|
||||||
|
g_string_append (result, ";unicast;client_port=%%u1-%%u2");
|
||||||
|
|
||||||
|
*transport = g_string_free (result, FALSE);
|
||||||
|
|
||||||
|
res = GST_RTSP_OK;
|
||||||
|
} else {
|
||||||
|
res = GST_RTSP_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gst_rtsp_google_finalize (GObject * object);
|
||||||
|
|
||||||
|
static GstStateChangeReturn gst_rtsp_google_change_state (GstElement * element,
|
||||||
|
GstStateChange transition);
|
||||||
|
|
||||||
|
static void gst_rtsp_google_extension_init (gpointer g_iface,
|
||||||
|
gpointer iface_data);
|
||||||
|
|
||||||
|
static void
|
||||||
|
_do_init (GType rtspgoogle_type)
|
||||||
|
{
|
||||||
|
static const GInterfaceInfo rtspextension_info = {
|
||||||
|
gst_rtsp_google_extension_init,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
g_type_add_interface_static (rtspgoogle_type, GST_TYPE_RTSP_EXTENSION,
|
||||||
|
&rtspextension_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_BOILERPLATE_FULL (GstRTSPGoogle, gst_rtsp_google, GstElement,
|
||||||
|
GST_TYPE_ELEMENT, _do_init);
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtsp_google_base_init (gpointer klass)
|
||||||
|
{
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
gst_element_class_set_details (element_class, &rtspgoogle_details);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtsp_google_class_init (GstRTSPGoogleClass * g_class)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class;
|
||||||
|
GstElementClass *gstelement_class;
|
||||||
|
GstRTSPGoogleClass *klass;
|
||||||
|
|
||||||
|
klass = (GstRTSPGoogleClass *) g_class;
|
||||||
|
gobject_class = (GObjectClass *) klass;
|
||||||
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
|
||||||
|
gobject_class->finalize = gst_rtsp_google_finalize;
|
||||||
|
|
||||||
|
gstelement_class->change_state =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_rtsp_google_change_state);
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (rtspgoogle_debug, "rtspgoogle", 0,
|
||||||
|
"Google RTSP extension");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtsp_google_init (GstRTSPGoogle * rtspgoogle, GstRTSPGoogleClass * klass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtsp_google_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstRTSPGoogle *rtspgoogle;
|
||||||
|
|
||||||
|
rtspgoogle = GST_RTSP_GOOGLE (object);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstStateChangeReturn
|
||||||
|
gst_rtsp_google_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
{
|
||||||
|
GstStateChangeReturn ret;
|
||||||
|
GstRTSPGoogle *rtspgoogle;
|
||||||
|
|
||||||
|
rtspgoogle = GST_RTSP_GOOGLE (element);
|
||||||
|
|
||||||
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_rtsp_google_extension_init (gpointer g_iface, gpointer iface_data)
|
||||||
|
{
|
||||||
|
GstRTSPExtensionInterface *iface = (GstRTSPExtensionInterface *) g_iface;
|
||||||
|
|
||||||
|
iface->before_send = gst_rtsp_google_before_send;
|
||||||
|
iface->after_send = gst_rtsp_google_after_send;
|
||||||
|
iface->get_transports = gst_rtsp_google_get_transports;
|
||||||
|
}
|
50
gst/rtsp/gstrtspgoogle.h
Normal file
50
gst/rtsp/gstrtspgoogle.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2008> Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GST_RTSP_GOOGLE_H__
|
||||||
|
#define __GST_RTSP_GOOGLE_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GST_TYPE_RTSP_GOOGLE (gst_rtsp_google_get_type())
|
||||||
|
#define GST_IS_RTSP_GOOGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTSP_GOOGLE))
|
||||||
|
#define GST_IS_RTSP_GOOGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTSP_GOOGLE))
|
||||||
|
#define GST_RTSP_GOOGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTSP_GOOGLE, GstRTSPGoogle))
|
||||||
|
#define GST_RTSP_GOOGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTSP_GOOGLE, GstRTSPGoogleClass))
|
||||||
|
|
||||||
|
typedef struct _GstRTSPGoogle GstRTSPGoogle;
|
||||||
|
typedef struct _GstRTSPGoogleClass GstRTSPGoogleClass;
|
||||||
|
|
||||||
|
struct _GstRTSPGoogle {
|
||||||
|
GstElement element;
|
||||||
|
|
||||||
|
gboolean active;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GstRTSPGoogleClass {
|
||||||
|
GstElementClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType gst_rtsp_google_get_type(void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GST_RTSP_GOOGLE_H__ */
|
|
@ -1205,7 +1205,10 @@ gst_rtspsrc_connection_send (GstRTSPSrc * src, GstRTSPMessage * message,
|
||||||
GstRTSPResult ret;
|
GstRTSPResult ret;
|
||||||
|
|
||||||
GST_RTSP_CONN_LOCK (src);
|
GST_RTSP_CONN_LOCK (src);
|
||||||
|
if (src->connection)
|
||||||
ret = gst_rtsp_connection_send (src->connection, message, timeout);
|
ret = gst_rtsp_connection_send (src->connection, message, timeout);
|
||||||
|
else
|
||||||
|
ret = GST_RTSP_ERROR;
|
||||||
GST_RTSP_CONN_UNLOCK (src);
|
GST_RTSP_CONN_UNLOCK (src);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1218,7 +1221,10 @@ gst_rtspsrc_connection_receive (GstRTSPSrc * src, GstRTSPMessage * message,
|
||||||
GstRTSPResult ret;
|
GstRTSPResult ret;
|
||||||
|
|
||||||
GST_RTSP_CONN_LOCK (src);
|
GST_RTSP_CONN_LOCK (src);
|
||||||
|
if (src->connection)
|
||||||
ret = gst_rtsp_connection_receive (src->connection, message, timeout);
|
ret = gst_rtsp_connection_receive (src->connection, message, timeout);
|
||||||
|
else
|
||||||
|
ret = GST_RTSP_ERROR;
|
||||||
GST_RTSP_CONN_UNLOCK (src);
|
GST_RTSP_CONN_UNLOCK (src);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2919,9 +2925,11 @@ gst_rtspsrc_loop_send_cmd (GstRTSPSrc * src, gint cmd, gboolean flush)
|
||||||
src->loop_cmd = cmd;
|
src->loop_cmd = cmd;
|
||||||
if (flush) {
|
if (flush) {
|
||||||
GST_DEBUG_OBJECT (src, "start connection flush");
|
GST_DEBUG_OBJECT (src, "start connection flush");
|
||||||
|
if (src->connection)
|
||||||
gst_rtsp_connection_flush (src->connection, TRUE);
|
gst_rtsp_connection_flush (src->connection, TRUE);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (src, "stop connection flush");
|
GST_DEBUG_OBJECT (src, "stop connection flush");
|
||||||
|
if (src->connection)
|
||||||
gst_rtsp_connection_flush (src->connection, FALSE);
|
gst_rtsp_connection_flush (src->connection, FALSE);
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
@ -3577,8 +3585,9 @@ static GstRTSPResult
|
||||||
gst_rtspsrc_create_transports_string (GstRTSPSrc * src,
|
gst_rtspsrc_create_transports_string (GstRTSPSrc * src,
|
||||||
GstRTSPLowerTrans protocols, gchar ** transports)
|
GstRTSPLowerTrans protocols, gchar ** transports)
|
||||||
{
|
{
|
||||||
gchar *result;
|
|
||||||
GstRTSPResult res;
|
GstRTSPResult res;
|
||||||
|
GString *result;
|
||||||
|
gboolean add_udp_str;
|
||||||
|
|
||||||
*transports = NULL;
|
*transports = NULL;
|
||||||
|
|
||||||
|
@ -3594,42 +3603,42 @@ gst_rtspsrc_create_transports_string (GstRTSPSrc * src,
|
||||||
if (*transports != NULL)
|
if (*transports != NULL)
|
||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
|
|
||||||
/* the default RTSP transports */
|
/* it's the default but some servers need it */
|
||||||
result = g_strdup ("");
|
add_udp_str = TRUE;
|
||||||
if (protocols & GST_RTSP_LOWER_TRANS_UDP) {
|
|
||||||
gchar *new;
|
|
||||||
|
|
||||||
|
/* the default RTSP transports */
|
||||||
|
result = g_string_new ("");
|
||||||
|
if (protocols & GST_RTSP_LOWER_TRANS_UDP) {
|
||||||
GST_DEBUG_OBJECT (src, "adding UDP unicast");
|
GST_DEBUG_OBJECT (src, "adding UDP unicast");
|
||||||
|
|
||||||
new =
|
g_string_append (result, "RTP/AVP");
|
||||||
g_strconcat (result, "RTP/AVP/UDP;unicast;client_port=%%u1-%%u2", NULL);
|
if (add_udp_str)
|
||||||
g_free (result);
|
g_string_append (result, "/UDP");
|
||||||
result = new;
|
g_string_append (result, ";unicast;client_port=%%u1-%%u2");
|
||||||
}
|
}
|
||||||
if (protocols & GST_RTSP_LOWER_TRANS_UDP_MCAST) {
|
if (protocols & GST_RTSP_LOWER_TRANS_UDP_MCAST) {
|
||||||
gchar *new;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "adding UDP multicast");
|
GST_DEBUG_OBJECT (src, "adding UDP multicast");
|
||||||
|
|
||||||
/* we don't have to allocate any UDP ports yet, if the selected transport
|
/* we don't have to allocate any UDP ports yet, if the selected transport
|
||||||
* turns out to be multicast we can create them and join the multicast
|
* turns out to be multicast we can create them and join the multicast
|
||||||
* group indicated in the transport reply */
|
* group indicated in the transport reply */
|
||||||
new = g_strconcat (result, result[0] ? "," : "",
|
if (result->len > 0)
|
||||||
"RTP/AVP/UDP;multicast", NULL);
|
g_string_append (result, ",");
|
||||||
g_free (result);
|
g_string_append (result, "RTP/AVP");
|
||||||
result = new;
|
if (add_udp_str)
|
||||||
|
g_string_append (result, "/UDP");
|
||||||
|
g_string_append (result, ";multicast");
|
||||||
}
|
}
|
||||||
if (protocols & GST_RTSP_LOWER_TRANS_TCP) {
|
if (protocols & GST_RTSP_LOWER_TRANS_TCP) {
|
||||||
gchar *new;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "adding TCP");
|
GST_DEBUG_OBJECT (src, "adding TCP");
|
||||||
|
|
||||||
new = g_strconcat (result, result[0] ? "," : "",
|
if (result->len > 0)
|
||||||
"RTP/AVP/TCP;unicast;interleaved=%%i1-%%i2", NULL);
|
g_string_append (result, ",");
|
||||||
g_free (result);
|
g_string_append (result, "RTP/AVP/TCP;unicast;interleaved=%%i1-%%i2");
|
||||||
result = new;
|
|
||||||
}
|
}
|
||||||
*transports = result;
|
*transports = g_string_free (result, FALSE);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "prepared transports %s", GST_STR_NULL (*transports));
|
||||||
|
|
||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
|
|
||||||
|
@ -3791,12 +3800,16 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src)
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto setup_transport_failed;
|
goto setup_transport_failed;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "replace ports in %s", GST_STR_NULL (transports));
|
||||||
|
|
||||||
/* replace placeholders with real values, this function will optionally
|
/* replace placeholders with real values, this function will optionally
|
||||||
* allocate UDP ports and other info needed to execute the setup request */
|
* allocate UDP ports and other info needed to execute the setup request */
|
||||||
res = gst_rtspsrc_prepare_transports (stream, &transports);
|
res = gst_rtspsrc_prepare_transports (stream, &transports);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
goto setup_transport_failed;
|
goto setup_transport_failed;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src, "transport is now %s", GST_STR_NULL (transports));
|
||||||
|
|
||||||
/* create SETUP request */
|
/* create SETUP request */
|
||||||
res =
|
res =
|
||||||
gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
gst_rtsp_message_init_request (&request, GST_RTSP_SETUP,
|
||||||
|
@ -4209,6 +4222,7 @@ setup_failed:
|
||||||
cleanup_error:
|
cleanup_error:
|
||||||
{
|
{
|
||||||
if (src->connection) {
|
if (src->connection) {
|
||||||
|
GST_DEBUG_OBJECT (src, "free connection");
|
||||||
gst_rtsp_connection_free (src->connection);
|
gst_rtsp_connection_free (src->connection);
|
||||||
src->connection = NULL;
|
src->connection = NULL;
|
||||||
}
|
}
|
||||||
|
@ -4266,6 +4280,9 @@ gst_rtspsrc_close (GstRTSPSrc * src)
|
||||||
src->task = NULL;
|
src->task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!src->connection)
|
||||||
|
goto done;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "stop connection flush");
|
GST_DEBUG_OBJECT (src, "stop connection flush");
|
||||||
gst_rtsp_connection_flush (src->connection, FALSE);
|
gst_rtsp_connection_flush (src->connection, FALSE);
|
||||||
|
|
||||||
|
@ -4297,6 +4314,7 @@ gst_rtspsrc_close (GstRTSPSrc * src)
|
||||||
gst_rtsp_connection_free (src->connection);
|
gst_rtsp_connection_free (src->connection);
|
||||||
src->connection = NULL;
|
src->connection = NULL;
|
||||||
|
|
||||||
|
done:
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
gst_rtspsrc_cleanup (src);
|
gst_rtspsrc_cleanup (src);
|
||||||
|
|
||||||
|
@ -4594,6 +4612,9 @@ gst_rtspsrc_pause (GstRTSPSrc * src)
|
||||||
GST_DEBUG_OBJECT (src, "connection is idle now");
|
GST_DEBUG_OBJECT (src, "connection is idle now");
|
||||||
GST_RTSP_CONN_UNLOCK (src);
|
GST_RTSP_CONN_UNLOCK (src);
|
||||||
|
|
||||||
|
if (!src->connection)
|
||||||
|
goto no_connection;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (src, "stop connection flush");
|
GST_DEBUG_OBJECT (src, "stop connection flush");
|
||||||
gst_rtsp_connection_flush (src->connection, FALSE);
|
gst_rtsp_connection_flush (src->connection, FALSE);
|
||||||
|
|
||||||
|
@ -4610,6 +4631,7 @@ gst_rtspsrc_pause (GstRTSPSrc * src)
|
||||||
gst_rtsp_message_unset (&request);
|
gst_rtsp_message_unset (&request);
|
||||||
gst_rtsp_message_unset (&response);
|
gst_rtsp_message_unset (&response);
|
||||||
|
|
||||||
|
no_connection:
|
||||||
src->state = GST_RTSP_STATE_READY;
|
src->state = GST_RTSP_STATE_READY;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Reference in a new issue