On 02/03/2012 02:13 PM, Paul B Mahol wrote: > From: Joakim Plate <[email protected]> > > Signed-off-by: Paul B Mahol <[email protected]> > --- > libavformat/cafdec.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c > index abde78d..458fdd0 100644 > --- a/libavformat/cafdec.c > +++ b/libavformat/cafdec.c > @@ -358,6 +358,7 @@ static int read_seek(AVFormatContext *s, int stream_index, > { > AVStream *st = s->streams[0]; > CaffContext *caf = s->priv_data; > + CaffContext caf2 = *caf; > int64_t pos; > > timestamp = FFMAX(timestamp, 0); > @@ -377,7 +378,10 @@ static int read_seek(AVFormatContext *s, int > stream_index, > return -1; > } > > - avio_seek(s->pb, pos + caf->data_start, SEEK_SET); > + if (avio_seek(s->pb, pos + caf->data_start, SEEK_SET) < 0) { > + *caf = caf2; > + return -1; > + } > return 0; > }
Instead of having a backup of the whole private context, we could use pkt_count and frame_count local variables, then only save them to the context on success before returning. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
