[FFmpeg-devel] [PATCH] rtpdec.c: don't overwrite pkt->stream_index in finalize_packet()

Ronald S. Bultje rsbultje
Sat Feb 28 18:36:41 CET 2009


There's this problem with proprietary protocols that they screw up.

For MS/ASF/RTP, what happened is that in multi-stream sessions, say
one where you're reading audio and video or where you have a high- and
a low-bitrate stream, there are (or could be) two active streams. Yet,
incoming RTP packets, regardless of TCP/UDP etc., will always have the
stream-id 0 (i.e. for TCP, the id after $ is 0, or for UDP, everything
arrives over a single RTP connection). The packet data containing the
ASF packet contains the actually correct stream-id, which is parsed in

Basically this means that the stream parameter in rtp_parse_packet()
and downstream functions is useless when there's an ASF payload. And
indeed, we basically don't use it except as a buffer cache (and that
works fine). However, rtpdec.c finalize_packet() overwrites
pkt->stream_index with st->index, and you can probably imagine that
this blows up. So, I'd like to be able to have the RTP payloader's
parse_packet() function fill in stream_index instead of having
finalize_packet() overwrite it.

I can do two things:
- do pkt->stream_index = st->index before calling the parse_packet()
function in rtp_parse_packet()
- make the payload parsers responsible for this.

My patch here implements the second solution, but the first would be
equally fine with me.


More information about the ffmpeg-devel mailing list