summaryrefslogtreecommitdiff
path: root/libavformat/nutdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r--libavformat/nutdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index afe19ffa75..6742ee9bdf 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1126,7 +1126,8 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
default:
resync:
av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
- tmp = find_any_startcode(bc, nut->last_syncpoint_pos + 1);
+ tmp = find_any_startcode(bc, FFMAX(nut->last_syncpoint_pos, nut->last_resync_pos) + 1);
+ nut->last_resync_pos = avio_tell(bc);
if (tmp == 0)
return AVERROR_INVALIDDATA;
av_log(s, AV_LOG_DEBUG, "sync\n");
@@ -1227,6 +1228,8 @@ static int read_seek(AVFormatContext *s, int stream_index,
for (i = 0; i < s->nb_streams; i++)
nut->stream[i].skip_until_key_frame = 1;
+ nut->last_resync_pos = 0;
+
return 0;
}