gst/rtsp/gstrtpdec.*: Add dummy latency property to be backwards compat with rtpbin.
authorWim Taymans <wim.taymans@gmail.com>
Wed, 25 Apr 2007 15:55:32 +0000 (15:55 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 25 Apr 2007 15:55:32 +0000 (15:55 +0000)
Original commit message from CVS:
* gst/rtsp/gstrtpdec.c: (gst_rtp_dec_class_init),
(gst_rtp_dec_init), (gst_rtp_dec_set_property),
(gst_rtp_dec_get_property):
* gst/rtsp/gstrtpdec.h:
Add dummy latency property to be backwards compat with rtpbin.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_class_init),
(gst_rtspsrc_set_property), (gst_rtspsrc_get_property),
(gst_rtspsrc_stream_configure_transport),
(gst_rtspsrc_parse_rtpinfo):
* gst/rtsp/gstrtspsrc.h:
Add latency property and configure in the session manager.
Don't set invalid clock-base and seqnum-base on caps, some servers
sometimes don't send them.

ChangeLog
gst/rtsp/gstrtpdec.c
gst/rtsp/gstrtpdec.h
gst/rtsp/gstrtspsrc.c
gst/rtsp/gstrtspsrc.h

index c26d49f..30eae99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-04-25  Wim Taymans  <wim@fluendo.com>
+
+       * gst/rtsp/gstrtpdec.c: (gst_rtp_dec_class_init),
+       (gst_rtp_dec_init), (gst_rtp_dec_set_property),
+       (gst_rtp_dec_get_property):
+       * gst/rtsp/gstrtpdec.h:
+       Add dummy latency property to be backwards compat with rtpbin.
+
+       * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_class_init),
+       (gst_rtspsrc_set_property), (gst_rtspsrc_get_property),
+       (gst_rtspsrc_stream_configure_transport),
+       (gst_rtspsrc_parse_rtpinfo):
+       * gst/rtsp/gstrtspsrc.h:
+       Add latency property and configure in the session manager.
+       Don't set invalid clock-base and seqnum-base on caps, some servers
+       sometimes don't send them.
+
 2007-04-25  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/alpha/gstalphacolor.c: (gst_alpha_color_base_init),
index a133999..3352b05 100644 (file)
@@ -80,9 +80,12 @@ enum
   LAST_SIGNAL
 };
 
+#define DEFAULT_LATENCY_MS      200
+
 enum
 {
   PROP_0,
+  PROP_LATENCY
 };
 
 static GstStaticPadTemplate gst_rtp_dec_recv_rtp_sink_template =
@@ -266,6 +269,11 @@ gst_rtp_dec_class_init (GstRTPDecClass * g_class)
   gobject_class->set_property = gst_rtp_dec_set_property;
   gobject_class->get_property = gst_rtp_dec_get_property;
 
+  g_object_class_install_property (gobject_class, PROP_LATENCY,
+      g_param_spec_uint ("latency", "Buffer latency in ms",
+          "Amount of ms to buffer", 0, G_MAXUINT, DEFAULT_LATENCY_MS,
+          G_PARAM_READWRITE));
+
   /**
    * GstRTPDec::request-pt-map:
    * @rtpdec: the object which received the signal
@@ -294,6 +302,7 @@ static void
 gst_rtp_dec_init (GstRTPDec * rtpdec, GstRTPDecClass * klass)
 {
   rtpdec->provided_clock = gst_system_clock_obtain ();
+  rtpdec->latency = DEFAULT_LATENCY_MS;
 }
 
 static void
@@ -584,7 +593,11 @@ gst_rtp_dec_set_property (GObject * object, guint prop_id,
   src = GST_RTP_DEC (object);
 
   switch (prop_id) {
+    case PROP_LATENCY:
+      src->latency = g_value_get_uint (value);
+      break;
     default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
 }
@@ -598,7 +611,11 @@ gst_rtp_dec_get_property (GObject * object, guint prop_id, GValue * value,
   src = GST_RTP_DEC (object);
 
   switch (prop_id) {
+    case PROP_LATENCY:
+      g_value_set_uint (value, src->latency);
+      break;
     default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
   }
 }
index 1c9f42e..5deca6e 100644 (file)
@@ -60,6 +60,7 @@ typedef struct _GstRTPDecSession GstRTPDecSession;
 struct _GstRTPDec {
   GstElement  element;
 
+  guint       latency;
   GSList     *sessions;
   GstClock   *provided_clock;
 };
index 066a17d..ef79b6e 100644 (file)
@@ -131,6 +131,7 @@ enum
 #define DEFAULT_DEBUG           FALSE
 #define DEFAULT_RETRY           20
 #define DEFAULT_TIMEOUT         5000000
+#define DEFAULT_LATENCY_MS      3000
 
 enum
 {
@@ -140,6 +141,7 @@ enum
   PROP_DEBUG,
   PROP_RETRY,
   PROP_TIMEOUT,
+  PROP_LATENCY,
 };
 
 #define GST_TYPE_RTSP_LOWER_TRANS (gst_rtsp_lower_trans_get_type())
@@ -272,6 +274,11 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
           0, G_MAXUINT64, DEFAULT_TIMEOUT,
           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
+  g_object_class_install_property (gobject_class, PROP_LATENCY,
+      g_param_spec_uint ("latency", "Buffer latency in ms",
+          "Amount of ms to buffer", 0, G_MAXUINT, DEFAULT_LATENCY_MS,
+          G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
   gstelement_class->change_state = gst_rtspsrc_change_state;
 
   gstbin_class->handle_message = gst_rtspsrc_handle_message;
@@ -349,6 +356,9 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
     case PROP_TIMEOUT:
       rtspsrc->timeout = g_value_get_uint64 (value);
       break;
+    case PROP_LATENCY:
+      rtspsrc->latency = g_value_get_uint (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -379,6 +389,9 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_TIMEOUT:
       g_value_set_uint64 (value, rtspsrc->timeout);
       break;
+    case PROP_LATENCY:
+      g_value_set_uint (value, rtspsrc->latency);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1173,6 +1186,8 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
       ret = gst_element_set_state (src->session, GST_STATE_PAUSED);
       if (ret == GST_STATE_CHANGE_FAILURE)
         goto start_session_failure;
+
+      g_object_set (src->session, "latency", src->latency, NULL);
     }
 
     /* we stream directly to the manager, get some pads. Each RTSP stream goes
@@ -2839,8 +2854,10 @@ gst_rtspsrc_parse_rtpinfo (GstRTSPSrc * src, gchar * rtpinfo)
       stream->timebase = timebase;
       if ((caps = stream->caps)) {
         /* update caps */
-        gst_caps_set_simple (caps, "clock-base", G_TYPE_UINT, timebase,
-            "seqnum-base", G_TYPE_UINT, seqbase, NULL);
+        if (timebase != -1)
+          gst_caps_set_simple (caps, "clock-base", G_TYPE_UINT, timebase, NULL);
+        if (seqbase != -1)
+          gst_caps_set_simple (caps, "seqnum-base", G_TYPE_UINT, seqbase, NULL);
       }
     }
   }
index c35c943..82582cf 100644 (file)
@@ -138,6 +138,7 @@ struct _GstRTSPSrc {
   gboolean         debug;
   guint           retry;
   guint64          timeout;
+  guint            latency;
 
   /* state */
   gchar           *content_base;