aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorelupus <elupus@ecce.se>2008-08-27 20:07:11 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-14 17:09:56 +0200
commit880e83827f47f638596cf60681ee1dfa89535c75 (patch)
treece278885128b1f1319ae4e1a28fd3173aa3a0664 /libavformat/mpegts.c
parent2130d2f5941a5384cb9522dee813302ca36b2376 (diff)
downloadffmpeg-880e83827f47f638596cf60681ee1dfa89535c75.tar.gz
respect the maximum position mpegts_get_pcr is allowed to seek to
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 4045f10f35..34f1c967b3 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1719,19 +1719,19 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
uint8_t buf[TS_PACKET_SIZE];
int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid;
pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
- for(;;) {
+ while(pos < pos_limit) {
avio_seek(s->pb, pos, SEEK_SET);
if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return AV_NOPTS_VALUE;
if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
parse_pcr(&timestamp, &pcr_l, buf) == 0) {
- break;
+ *ppos = pos;
+ return timestamp;
}
pos += ts->raw_packet_size;
}
- *ppos = pos;
- return timestamp;
+ return AV_NOPTS_VALUE;
}
#ifdef USE_SYNCPOINT_SEARCH