Revision 3a1cdcc7 libavformat/rtpdec.c
libavformat/rtpdec.c | ||
---|---|---|
123 | 123 |
payload_len = (AV_RB16(buf + 2) + 1) * 4; |
124 | 124 |
|
125 | 125 |
s->last_rtcp_ntp_time = AV_RB64(buf + 8); |
126 |
if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) |
|
127 |
s->first_rtcp_ntp_time = s->last_rtcp_ntp_time; |
|
128 | 126 |
s->last_rtcp_timestamp = AV_RB32(buf + 16); |
127 |
if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE) { |
|
128 |
s->first_rtcp_ntp_time = s->last_rtcp_ntp_time; |
|
129 |
if (!s->base_timestamp) |
|
130 |
s->base_timestamp = s->last_rtcp_timestamp; |
|
131 |
s->rtcp_ts_offset = s->last_rtcp_timestamp - s->base_timestamp; |
|
132 |
} |
|
129 | 133 |
|
130 | 134 |
buf += payload_len; |
131 | 135 |
len -= payload_len; |
... | ... | |
440 | 444 |
delta_timestamp = timestamp - s->last_rtcp_timestamp; |
441 | 445 |
/* convert to the PTS timebase */ |
442 | 446 |
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); |
443 |
pkt->pts = s->range_start_offset + addend + delta_timestamp; |
|
447 |
pkt->pts = s->range_start_offset + s->rtcp_ts_offset + addend + |
|
448 |
delta_timestamp; |
|
449 |
return; |
|
444 | 450 |
} |
451 |
if (timestamp == RTP_NOTS_VALUE) |
|
452 |
return; |
|
453 |
if (!s->base_timestamp) |
|
454 |
s->base_timestamp = timestamp; |
|
455 |
pkt->pts = s->range_start_offset + timestamp - s->base_timestamp; |
|
445 | 456 |
} |
446 | 457 |
|
447 | 458 |
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, |
Also available in: Unified diff