On Sun, Aug 25, 2019 at 11:37:02PM -0300, James Almer wrote:
> On 8/24/2019 3:18 PM, Michael Niedermayer wrote:
> > Fixes: Ticket7880
> > 
> > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> > ---
> >  libavcodec/qtrle.c        | 30 ++++++++++++++++++++++++++----
> >  tests/ref/fate/qtrle-8bit |  1 +
> >  2 files changed, 27 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
> > index 2c29547e5a..c22a1a582d 100644
> > --- a/libavcodec/qtrle.c
> > +++ b/libavcodec/qtrle.c
> > @@ -45,6 +45,7 @@ typedef struct QtrleContext {
> >  
> >      GetByteContext g;
> >      uint32_t pal[256];
> > +    AVPacket flush_pkt;
> >  } QtrleContext;
> >  
> >  #define CHECK_PIXEL_PTR(n)                                                 
> >            \
> > @@ -454,11 +455,27 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
> >      int has_palette = 0;
> >      int ret, size;
> >  
> > +    if (!avpkt->data) {
> > +        if (avctx->internal->need_flush) {
> > +            avctx->internal->need_flush = 0;
> 
> This same effect can be achieved by instead checking for
> s->frame->data[0] != NULL after adding a AVCodec.flush() callback that
> unrefs s->frame (Which should be added regardless of this patch).
> 
> That way you wont need to add need_flush to AVCodecInternal.

need_flush in common code was done to avoid haveing the same code in
every decoder as shown in the previous iteration of the patchset

Avoiding the need_flush completely by clearing the internal frame
might not work completly because there are more cases than this
1. seek (clear the last frame is possible so here it works)
2. output a frame (here we cannot clear the frame as it may be used by the next
   frame, still this is the same case, if a frame was just output
   theres no need to flush at the end so we also need need_flush = 0

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to