[FFmpeg-devel] [PATCH] RTSP-MS 5-6/15: parse only the last m= line stream per rtpmap line

Luca Barbato lu_zero
Fri Jan 9 16:31:59 CET 2009


Ronald S. Bultje wrote:
> Hi Luca,
> 
> On Tue, Jan 6, 2009 at 7:40 AM, Luca Barbato <lu_zero at gentoo.org> wrote:
>> Ronald S. Bultje wrote:
>>> as can be seen in [1] (see my recent post in [2]), RTSP-MS SDP
>>> contains one rtpmap: line per m=, and this rtpmap is generally the
>>> same. My impression is that this is true for all RTSP streams, and the
>>> ffmpeg implementation indeed only supports rtpmap lines coming after
>>> m= lines. However, rtsp.c loops over all streams and reinits each of
>>> them if the rtpmap code matches that stream code, leading to unneeded
>>> reinitializations for previous streams. the attached patch fixes that.
> 
> This fixes a potential crasher if no m= lines precede the rtpmap. Luca
> A. suggested to remove the condition around this statement also:
> 
>                  if (rtsp_st->sdp_payload_type == payload_type) {
>                      sdp_parse_rtpmap(st->codec, rtsp_st, payload_type, p);
>                  }
> 
> i.e.:
> 
>              /* NOTE: rtpmap is only supported AFTER the 'm=' tag */
>              get_word(buf1, sizeof(buf1), &p);
>              payload_type = atoi(buf1);
> -            for(i = 0; i < s->nb_streams;i++) {
> -                st = s->streams[i];
> +            st = s->streams[s->nb_streams - 1];
>                  rtsp_st = st->priv_data;
> -                if (rtsp_st->sdp_payload_type == payload_type) {
>                      sdp_parse_rtpmap(st->codec, rtsp_st, payload_type, p);
> -                }
> -            }
>          } else if (av_strstart(p, "fmtp:", &p)) {
>              /* NOTE: fmtp is only supported AFTER the 'a=rtpmap:xxx' tag */
>              get_word(buf1, sizeof(buf1), &p);
> 
> What do others think? Keep or remove?

Anything that simplifies goes in.

I have an halfway working rtsp parser written using ragel but I'm not 
sure about planting it in ffmpeg...

Michael et all, you'd let some generated code (that requires ragel to be 
updated) in ffmpeg? ^^;

lu

-- 

Luca Barbato
Gentoo Council Member
Gentoo/linux Gentoo/PPC
http://dev.gentoo.org/~lu_zero





More information about the ffmpeg-devel mailing list