nutdec: fix infinite resync loops
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Tue, 19 May 2015 22:06:05 +0000 (00:06 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Wed, 20 May 2015 17:07:26 +0000 (19:07 +0200)
commit37e679881d364b6da817d829d35869d657218ab3
tree10d2e98a4bd7f7a8913e447f3625f4f755c39795
parentb6ca7bfc7c12356e9e33eeab0ee8bf7ec865b944
nutdec: fix infinite resync loops

nut->last_syncpoint_pos doesn't necessarily change between resync
attempts, so find_any_startcode can return the same startcode again.

Thus remember where the last resync happened and don't try to resync
before that.

This can't be done locally in nut_read_packet, because this wouldn't
prevent infinite resync loops, where after the resync a packet is
returned and while reading a following packet the resync happens again.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/nut.h
libavformat/nutdec.c