fix rtsp playback in gstreamer
authorFraxinas <andreas.frisch@multimedia-labs.de>
Tue, 6 Jul 2010 16:52:39 +0000 (18:52 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Tue, 6 Jul 2010 21:19:46 +0000 (23:19 +0200)
recipes/gstreamer/gst-plugins-good/rtspsrc-fixports.patch [new file with mode: 0644]
recipes/gstreamer/gst-plugins-good/udpsrc-fixports.patch [new file with mode: 0644]
recipes/gstreamer/gst-plugins-good_0.10.23.bb

diff --git a/recipes/gstreamer/gst-plugins-good/rtspsrc-fixports.patch b/recipes/gstreamer/gst-plugins-good/rtspsrc-fixports.patch
new file mode 100644 (file)
index 0000000..209929c
--- /dev/null
@@ -0,0 +1,34 @@
+commit 6717476a946131c418837ae85de9f2c6ef68e7e9
+Author: Wim Taymans <wim.taymans@collabora.co.uk>
+Date:   Tue Jul 6 18:22:24 2010 +0200
+
+    rtspsrc: don't reuse udp sockets
+    
+    Don't reuse sockets but make the udpsrc element fail the state change when the
+    socket is already in use. If we don't prevent reuse, we might end up using the same
+    port for different streams in some cases.
+    
+    Fixes #622017
+
+diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
+index 9b33bf5..6133718 100644
+--- a/gst/rtsp/gstrtspsrc.c
++++ b/gst/rtsp/gstrtspsrc.c
+@@ -1391,7 +1391,7 @@ again:
+   udpsrc0 = gst_element_make_from_uri (GST_URI_SRC, host, NULL);
+   if (udpsrc0 == NULL)
+     goto no_udp_protocol;
+-  g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, NULL);
++  g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, "reuse", FALSE, NULL);
+   ret = gst_element_set_state (udpsrc0, GST_STATE_PAUSED);
+   if (ret == GST_STATE_CHANGE_FAILURE) {
+@@ -1439,7 +1439,7 @@ again:
+   /* set port */
+   tmp_rtcp = tmp_rtp + 1;
+-  g_object_set (G_OBJECT (udpsrc1), "port", tmp_rtcp, NULL);
++  g_object_set (G_OBJECT (udpsrc1), "port", tmp_rtcp, "reuse", FALSE, NULL);
+   GST_DEBUG_OBJECT (src, "starting RTCP on port %d", tmp_rtcp);
+   ret = gst_element_set_state (udpsrc1, GST_STATE_PAUSED);
diff --git a/recipes/gstreamer/gst-plugins-good/udpsrc-fixports.patch b/recipes/gstreamer/gst-plugins-good/udpsrc-fixports.patch
new file mode 100644 (file)
index 0000000..d3b0a77
--- /dev/null
@@ -0,0 +1,86 @@
+commit 9ab43fe647ddd5abd78c1e8f32d1c745ad435f0b
+Author: Wim Taymans <wim.taymans@collabora.co.uk>
+Date:   Tue Jul 6 18:11:21 2010 +0200
+
+    udpsrc: add property to enable port reuse
+
+diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c
+index 664d6bb..7bca02b 100644
+--- a/gst/udp/gstudpsrc.c
++++ b/gst/udp/gstudpsrc.c
+@@ -145,6 +145,7 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+ #define UDP_DEFAULT_CLOSEFD            TRUE
+ #define UDP_DEFAULT_SOCK                -1
+ #define UDP_DEFAULT_AUTO_MULTICAST     TRUE
++#define UDP_DEFAULT_REUSE              TRUE
+ enum
+ {
+@@ -162,6 +163,7 @@ enum
+   PROP_CLOSEFD,
+   PROP_SOCK,
+   PROP_AUTO_MULTICAST,
++  PROP_REUSE,
+   PROP_LAST
+ };
+@@ -291,6 +293,9 @@ gst_udpsrc_class_init (GstUDPSrcClass * klass)
+       g_param_spec_boolean ("auto-multicast", "Auto Multicast",
+           "Automatically join/leave multicast groups",
+           UDP_DEFAULT_AUTO_MULTICAST, G_PARAM_READWRITE));
++  g_object_class_install_property (gobject_class, PROP_REUSE,
++      g_param_spec_boolean ("reuse", "Reuse", "Enable reuse of the port",
++          UDP_DEFAULT_REUSE, G_PARAM_READWRITE));
+   gstbasesrc_class->start = gst_udpsrc_start;
+   gstbasesrc_class->stop = gst_udpsrc_stop;
+@@ -318,6 +323,7 @@ gst_udpsrc_init (GstUDPSrc * udpsrc, GstUDPSrcClass * g_class)
+   udpsrc->externalfd = (udpsrc->sockfd != -1);
+   udpsrc->auto_multicast = UDP_DEFAULT_AUTO_MULTICAST;
+   udpsrc->sock.fd = UDP_DEFAULT_SOCK;
++  udpsrc->reuse = UDP_DEFAULT_REUSE;
+   /* configure basesrc to be a live source */
+   gst_base_src_set_live (GST_BASE_SRC (udpsrc), TRUE);
+@@ -693,6 +699,9 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
+     case PROP_AUTO_MULTICAST:
+       udpsrc->auto_multicast = g_value_get_boolean (value);
+       break;
++    case PROP_REUSE:
++      udpsrc->reuse = g_value_get_boolean (value);
++      break;
+     default:
+       break;
+   }
+@@ -741,6 +750,9 @@ gst_udpsrc_get_property (GObject * object, guint prop_id, GValue * value,
+     case PROP_AUTO_MULTICAST:
+       g_value_set_boolean (value, udpsrc->auto_multicast);
+       break;
++    case PROP_REUSE:
++      g_value_set_boolean (value, udpsrc->reuse);
++      break;
+     default:
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+       break;
+@@ -782,7 +794,8 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
+     GST_DEBUG_OBJECT (src, "got socket %d", src->sock.fd);
+-    reuse = 1;
++    GST_DEBUG_OBJECT (src, "setting reuse %d", src->reuse);
++    reuse = src->reuse ? 1 : 0;
+     if ((ret =
+             setsockopt (src->sock.fd, SOL_SOCKET, SO_REUSEADDR, &reuse,
+                 sizeof (reuse))) < 0)
+diff --git a/gst/udp/gstudpsrc.h b/gst/udp/gstudpsrc.h
+index ea6a0bf..48c9f16 100644
+--- a/gst/udp/gstudpsrc.h
++++ b/gst/udp/gstudpsrc.h
+@@ -63,6 +63,7 @@ struct _GstUDPSrc {
+   int        sockfd;
+   gboolean   closefd;
+   gboolean   auto_multicast;
++  gboolean   reuse;
+   /* our sockets */
+   GstPollFD  sock;
index db1400e..3c5847e 100644 (file)
@@ -1,7 +1,7 @@
 require gst-plugins.inc
 
-SRC_URI += "file://flvdemux-ecma.diff;patch=1 "
-PR = "${INC_PR}.0"
+SRC_URI += "file://flvdemux-ecma.diff;patch=1 file://rtspsrc-fixports.patch;patch=1 file://udpsrc-fixports.patch;patch=1"
+PR = "${INC_PR}.1"
 
 DEPENDS += "gst-plugins-base"