[FFmpeg-devel] [PATCH 1/3] Check for missing reference frames in bink decoder.
Michael Niedermayer
michaelni at gmx.at
Tue Sep 27 23:47:19 CEST 2011
On Tue, Sep 27, 2011 at 11:42:27PM +0200, Laurent Aimar wrote:
> On Tue, Sep 27, 2011 at 03:49:42AM +0200, Michael Niedermayer wrote:
> > On Tue, Sep 27, 2011 at 01:02:15AM +0200, fenrir at elivagar.org wrote:
> > > From: Laurent Aimar <fenrir at videolan.org>
> > >
> > > ---
> > > libavcodec/bink.c | 16 ++++++++++++++++
> > > 1 files changed, 16 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/libavcodec/bink.c b/libavcodec/bink.c
> > > index e137312..045cd46 100644
> > > --- a/libavcodec/bink.c
> > > +++ b/libavcodec/bink.c
> > > @@ -992,6 +992,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
> > > }
> > > switch (blk) {
> > > case SKIP_BLOCK:
> > > + if (!c->last.data[0]) {
> > > + av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
> > > + return -1;
> > > + }
> > > c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8);
> > > break;
> > > case SCALED_BLOCK:
> > > @@ -1055,6 +1059,10 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
> > > prev += 8;
> > > break;
> > > case MOTION_BLOCK:
> > > + if (!c->last.data[0]) {
> > > + av_log(c->avctx, AV_LOG_ERROR, "Missing reference frame\n");
> > > + return -1;
> > > + }
> > > xoff = get_value(c, BINK_SRC_X_OFF);
> > > yoff = get_value(c, BINK_SRC_Y_OFF);
> > > ref = prev + xoff + yoff * stride;
> >
> > I think its better to skip the block and continue instead of aborting
> > This would allow partially decoding the frame unless i miss something
> >
> > Another, maybe easier alternative would be allocating a dummy frame
> > or asigning the current frame to last*
> I took the easy way ;)
>
> Patch attach.
easy is good and applied
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110927/4c97b5e3/attachment.asc>
More information about the ffmpeg-devel
mailing list