[vlc-commits] RTP: print an explanatory error in case of dynamic payload format

Rémi Denis-Courmont git at videolan.org
Fri Nov 4 17:10:43 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov  4 17:54:43 2011 +0200| [6af92f68167d947106ddd6cb90ec9f9234910339] | committer: Rémi Denis-Courmont

RTP: print an explanatory error in case of dynamic payload format

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6af92f68167d947106ddd6cb90ec9f9234910339
---

 modules/access/rtp/input.c |    3 +--
 modules/access/rtp/rtp.c   |   17 ++++++++++++-----
 modules/access/rtp/rtp.h   |    2 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/access/rtp/input.c b/modules/access/rtp/input.c
index 1641c1a..2300143 100644
--- a/modules/access/rtp/input.c
+++ b/modules/access/rtp/input.c
@@ -69,8 +69,7 @@ static void rtp_process (demux_t *demux, block_t *block)
     /* TODO: use SDP and get rid of this hack */
     if (unlikely(sys->autodetect))
     {   /* Autodetect payload type, _before_ rtp_queue() */
-        if (rtp_autodetect (demux, sys->session, block))
-            goto drop;
+        rtp_autodetect (demux, sys->session, block);
         sys->autodetect = false;
     }
 
diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index c6fea43..d0a8fa2 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -32,6 +32,7 @@
 #include <vlc_demux.h>
 #include <vlc_network.h>
 #include <vlc_plugin.h>
+#include <vlc_dialog.h>
 
 #include "rtp.h"
 #ifdef HAVE_SRTP
@@ -613,8 +614,8 @@ static void *ts_init (demux_t *demux)
 
 /* Not using SDP, we need to guess the payload format used */
 /* see http://www.iana.org/assignments/rtp-parameters */
-int rtp_autodetect (demux_t *demux, rtp_session_t *session,
-                    const block_t *block)
+void rtp_autodetect (demux_t *demux, rtp_session_t *session,
+                     const block_t *block)
 {
     uint8_t ptype = rtp_ptype (block);
     rtp_pt_t pt = {
@@ -715,14 +716,20 @@ int rtp_autodetect (demux_t *demux, rtp_session_t *session,
                 pt.frequency = 90000;
             }
             else
-                msg_Err (demux, "invalid dynamic payload format `%s' "
+                msg_Err (demux, "unknown dynamic payload format `%s' "
                                 "specified", dynamic);
             free (dynamic);
         }
-        return -1;
+
+        msg_Err (demux, "unspecified payload format (type %"PRIu8")", ptype);
+        msg_Info (demux, "A valid SDP is needed to parse this RTP stream.");
+        dialog_Fatal (demux, N_("SDP required"),
+             N_("A description in SDP format is required to receive the RTP "
+                "stream. Note that rtp:// URIs cannot work with dynamic "
+                "RTP payload format (%"PRIu8")."), ptype);
+        return;
     }
     rtp_add_type (demux, session, &pt);
-    return 0;
 }
 
 /*
diff --git a/modules/access/rtp/rtp.h b/modules/access/rtp/rtp.h
index 0e2d280..1625d16 100644
--- a/modules/access/rtp/rtp.h
+++ b/modules/access/rtp/rtp.h
@@ -32,7 +32,7 @@ struct rtp_pt_t
     uint32_t  frequency; /* RTP clock rate (Hz) */
     uint8_t   number;
 };
-int rtp_autodetect (demux_t *, rtp_session_t *, const block_t *);
+void rtp_autodetect (demux_t *, rtp_session_t *, const block_t *);
 
 static inline uint8_t rtp_ptype (const block_t *block)
 {



More information about the vlc-commits mailing list