[FFmpeg-devel] [PATCH 1/3] nutdec: fix infinite resync loops
Michael Niedermayer
michaelni at gmx.at
Wed May 20 16:53:00 CEST 2015
On Wed, May 20, 2015 at 04:34:49PM +0200, Andreas Cadhalpun wrote:
> On 20.05.2015 02:00, Michael Niedermayer wrote:
> > On Wed, May 20, 2015 at 12:49:49AM +0200, Andreas Cadhalpun wrote:
> >> 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.
> >>
> >> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> >> ---
> >> libavformat/nut.h | 1 +
> >> libavformat/nutdec.c | 3 ++-
> >> 2 files changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavformat/nut.h b/libavformat/nut.h
> >> index 943081c..0c678a5 100644
> >> --- a/libavformat/nut.h
> >> +++ b/libavformat/nut.h
> >> @@ -102,6 +102,7 @@ typedef struct NUTContext {
> >> unsigned int max_distance;
> >> unsigned int time_base_count;
> >> int64_t last_syncpoint_pos;
> >> + int64_t last_resync_pos;
> >
> > i think this and possibly some other fields must be reset on seeking
> > otherwise resync after seeking could break
>
> Attached patch resets last_resync_pos in read_seek.
> I'm not sure if last_syncpoint_pos also has to be reset or if the
> syncpoint handling at the end of read_seek is already enough.
>
> Best regards,
> Andreas
>
> nut.h | 1 +
> nutdec.c | 5 ++++-
> 2 files changed, 5 insertions(+), 1 deletion(-)
> b32d36842ae472ac23d4445d35cee09c8a9adc46 0001-nutdec-fix-infinite-resync-loops.patch
> From 0b000f4463cfb8d40571fd0620ec5f536296ea1b Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> Date: Wed, 20 May 2015 00:06:05 +0200
> Subject: [PATCH 1/3] nutdec: fix infinite resync loops
LGTM
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150520/d776335b/attachment.asc>
More information about the ffmpeg-devel
mailing list