Mercurial > libavformat.hg
comparison rtpdec.c @ 4633:0c69b895a01f libavformat
Don't let finalize_packet() touch pkt->stream_index. Instead, let individual
payload handlers take care of that themselves at their own option. What this
patch really does is "fix" a bug in MS-RTSP protocol where incoming packets
are always coming in over the connection (UDP) or interleave-id (TCP) of
the stream-id of the first ASF packet in the RTP packet. However, RTP packets
may contain multiple ASF packets (and usually do, from what I can see), and
therefore this leads to playback bugs. The intended stream-id per ASF packet
is given in the respective ASF packet header. The ASF demuxer will correctly
read this and set pkt->stream_index, but since the "stream" parameter can
not be known to rtpdec.c or any of the RTP/RTSP code, the "st" parameter
in all these functions is basically invalid. Therefore, using st->id as
pkt->stream_index leads to various playback bugs. The result of this patch
is that pkt->stream_index is left untouched for RTP/ASF (and possibly for
other payloads that have similar behaviour).
The patch was discussed in the "[PATCH] rtpdec.c: don't overwrite
pkt->stream_index in finalize_packet()" thread on the mailinglist.
author | rbultje |
---|---|
date | Tue, 03 Mar 2009 13:51:34 +0000 |
parents | 232a9af14aea |
children | c78617194786 |
comparison
equal
deleted
inserted
replaced
4632:232a9af14aea | 4633:0c69b895a01f |
---|---|
380 delta_timestamp = timestamp - s->last_rtcp_timestamp; | 380 delta_timestamp = timestamp - s->last_rtcp_timestamp; |
381 /* convert to the PTS timebase */ | 381 /* convert to the PTS timebase */ |
382 addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32); | 382 addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32); |
383 pkt->pts = addend + delta_timestamp; | 383 pkt->pts = addend + delta_timestamp; |
384 } | 384 } |
385 pkt->stream_index = s->st->index; | |
386 } | 385 } |
387 | 386 |
388 /** | 387 /** |
389 * Parse an RTP or RTCP packet directly sent as a buffer. | 388 * Parse an RTP or RTCP packet directly sent as a buffer. |
390 * @param s RTP parse context. | 389 * @param s RTP parse context. |
534 default: | 533 default: |
535 av_new_packet(pkt, len); | 534 av_new_packet(pkt, len); |
536 memcpy(pkt->data, buf, len); | 535 memcpy(pkt->data, buf, len); |
537 break; | 536 break; |
538 } | 537 } |
538 | |
539 pkt->stream_index = st->index; | |
539 } | 540 } |
540 | 541 |
541 // now perform timestamp things.... | 542 // now perform timestamp things.... |
542 finalize_packet(s, pkt, timestamp); | 543 finalize_packet(s, pkt, timestamp); |
543 | 544 |