gst/rtsp/gstrtspsrc.c: Fix default clock-rate for realmedia.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 3 Aug 2007 16:08:56 +0000 (16:08 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 3 Aug 2007 16:08:56 +0000 (16:08 +0000)
Original commit message from CVS:
* gst/rtsp/gstrtspsrc.c: (get_default_rate_for_pt),
(gst_rtspsrc_parse_rtpmap), (gst_rtspsrc_media_to_caps),
(gst_rtspsrc_stream_configure_tcp),
(gst_rtspsrc_stream_configure_udp_sink):
Fix default clock-rate for realmedia.
Fix parsing of transport.
Don't try to link NULL pads.

ChangeLog
gst/rtsp/gstrtspsrc.c

index 415243f..ddc9093 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-08-03  Wim Taymans  <wim.taymans@gmail.com>
+
+       * gst/rtsp/gstrtspsrc.c: (get_default_rate_for_pt),
+       (gst_rtspsrc_parse_rtpmap), (gst_rtspsrc_media_to_caps),
+       (gst_rtspsrc_stream_configure_tcp),
+       (gst_rtspsrc_stream_configure_udp_sink):
+       Fix default clock-rate for realmedia.
+       Fix parsing of transport.
+       Don't try to link NULL pads.
+
 2007-07-30  Tim-Philipp Müller  <tim at centricular dot net>
 
        * po/POTFILES.skip:
index 07323fd..e02114e 100644 (file)
@@ -646,7 +646,7 @@ gst_rtspsrc_cleanup (GstRTSPSrc * src)
 /* FIXME, this should go somewhere else, ideally 
  */
 static guint
-get_default_rate_for_pt (gint pt)
+get_default_rate_for_pt (gint pt, gchar * name, gchar * params)
 {
   switch (pt) {
     case 0:
@@ -680,7 +680,11 @@ get_default_rate_for_pt (gint pt)
     case 34:
       return 90000;
     default:
+    {
+      if (g_str_has_prefix (name, "x-pn-real"))
+        return 1000;
       return -1;
+    }
   }
 }
 
@@ -701,8 +705,10 @@ G_STMT_START {                          \
 G_STMT_START {                          \
   gchar *t = p;                         \
   p = strstr (p, del);                  \
-  if (p == NULL)                        \
+  if (p == NULL) {                      \
     res = NULL;                         \
+    p = t;                              \
+  }                                     \
   else {                                \
     *p = '\0';                          \
     p++;                                \
@@ -736,6 +742,7 @@ gst_rtspsrc_parse_rtpmap (const gchar * rtpmap, gint * payload, gchar ** name,
 
   PARSE_STRING (p, "/", *name);
   if (*name == NULL) {
+    GST_DEBUG ("no rate, name %s", p);
     /* no rate, assume -1 then */
     *name = p;
     *rate = -1;
@@ -808,7 +815,7 @@ gst_rtspsrc_media_to_caps (gint pt, const GstSDPMedia * media)
   /* check if we have a rate, if not, we need to look up the rate from the
    * default rates based on the payload types. */
   if (rate == -1) {
-    rate = get_default_rate_for_pt (pt);
+    rate = get_default_rate_for_pt (pt, name, params);
     /* we fail if we cannot find one */
     if (rate == -1)
       goto no_rate;
@@ -1634,7 +1641,8 @@ gst_rtspsrc_stream_configure_tcp (GstRTSPSrc * src, GstRTSPStream * stream,
     g_free (name);
 
     /* and link */
-    gst_pad_link (pad, stream->rtcppad);
+    if (pad)
+      gst_pad_link (pad, stream->rtcppad);
   }
   return TRUE;
 }
@@ -1806,7 +1814,8 @@ gst_rtspsrc_stream_configure_udp_sink (GstRTSPSrc * src, GstRTSPStream * stream,
   g_free (name);
 
   /* and link */
-  gst_pad_link (pad, stream->rtcppad);
+  if (pad)
+    gst_pad_link (pad, stream->rtcppad);
 
   return TRUE;