[FFmpeg-devel] rtsp.c: a=rtpmap: parsing implementation?

Ronald S. Bultje rsbultje
Mon Jan 5 03:19:12 CET 2009


Hi,

rtsp.c:500 has this code

        } else if (av_strstart(p, "rtpmap:", &p)) {
            /* 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];
                rtsp_st = st->priv_data;
                if (rtsp_st->sdp_payload_type == payload_type) {
                    sdp_parse_rtpmap(st->codec, rtsp_st, payload_type, p);
                }
            }

You'll see the a=rtpmap: line is applied to all RTSPStreams, not just
the current one. RTSP-MS has several m= lines (one for each
bitrate/codec/etc. choice), and therefore the same rtpmap: is repeated
for each m= line in the SDP. This causes the dynamic RTP parser for
_all_ preceeding m= lines to be re-initialized (see
sdp_parse_rtpmap()) every time we encounter a rtpmap: line in the SDP.
Is there a reason for this or is it OK to change this so rtpmap: lines
only affect the last m= line's RTPSStream? (Two patches of course, one
for the removal of the for() loop and the st= line change, and one for
reindenting the rest).

        } else if (av_strstart(p, "rtpmap:", &p)) {
            /* NOTE: rtpmap is only supported AFTER the 'm=' tag */
            get_word(buf1, sizeof(buf1), &p);
            payload_type = atoi(buf1);
            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);
            }

Ronald




More information about the ffmpeg-devel mailing list