rtsp: Check for dynamic payload handlers if no static payload mapping was found

Message ID 1338025248-80540-1-git-send-email-martin@martin.st
State Committed
Commit 6099543ad4c78df45c580f6660d19c33e483a594
Headers show

Commit Message

Martin Storsjö May 26, 2012, 9:40 a.m.
Some systems seem to abuse the static payload types 35 or 36
(which according to IANA are unassigned) for H264.
---
 libavformat/rtsp.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Luca Barbato May 26, 2012, 5:01 p.m. | #1
On 26/05/12 02:40, Martin Storsjö wrote:
> Some systems seem to abuse the static payload types 35 or 36
> (which according to IANA are unassigned) for H264.
> ---
>  libavformat/rtsp.c |   14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 

ok..

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 963d467..367181d 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -198,7 +198,14 @@  static int sdp_parse_rtpmap(AVFormatContext *s,
      * particular servers ("RealServer Version 6.1.3.970", see issue 1658)
      * have a trailing space. */
     get_word_sep(buf, sizeof(buf), "/ ", &p);
-    if (payload_type >= RTP_PT_PRIVATE) {
+    if (payload_type < RTP_PT_PRIVATE) {
+        /* We are in a standard case
+         * (from http://www.iana.org/assignments/rtp-parameters). */
+        /* search into AVRtpPayloadTypes[] */
+        codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
+    }
+
+    if (codec->codec_id == CODEC_ID_NONE) {
         RTPDynamicProtocolHandler *handler =
             ff_rtp_handler_find_by_name(buf, codec->codec_type);
         init_rtp_handler(handler, rtsp_st, codec);
@@ -208,11 +215,6 @@  static int sdp_parse_rtpmap(AVFormatContext *s,
          * the format name from the rtpmap line never is passed into rtpdec. */
         if (!rtsp_st->dynamic_handler)
             codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
-    } else {
-        /* We are in a standard case
-         * (from http://www.iana.org/assignments/rtp-parameters). */
-        /* search into AVRtpPayloadTypes[] */
-        codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
     }
 
     c = avcodec_find_decoder(codec->codec_id);