On Mon, 19 May 2014 11:49:27 +0200, Janne Grunau <[email protected]> wrote:
> On 2014-05-18 21:30:26 +0200, Anton Khirnov wrote:
> > This also handles side data properly.
> > ---
> >  libavcodec/pthread_frame.c |   17 +++--------------
> >  1 file changed, 3 insertions(+), 14 deletions(-)
> > 
> > diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> > index 34ca9a6..66b1b20 100644
> > --- a/libavcodec/pthread_frame.c
> > +++ b/libavcodec/pthread_frame.c
> > @@ -63,8 +63,6 @@ typedef struct PerThreadContext {
> >      AVCodecContext *avctx;          ///< Context used to decode packets 
> > passed to this thread.
> >  
> >      AVPacket       avpkt;           ///< Input packet (for decoding) or 
> > output (for encoding).
> > -    uint8_t       *buf;             ///< backup storage for packet data 
> > when the input packet is not refcounted
> > -    int            allocated_buf_size; ///< Size allocated for buf
> >  
> >      AVFrame *frame;                 ///< Output frame (for decoding) or 
> > input (for encoding).
> >      int     got_frame;              ///< The output of got_picture_ptr 
> > from the last avcodec_decode_video() call.
> > @@ -317,16 +315,8 @@ static int submit_packet(PerThreadContext *p, AVPacket 
> > *avpkt)
> >          }
> >      }
> >  
> > -    av_buffer_unref(&p->avpkt.buf);
> > -    p->avpkt = *avpkt;
> > -    if (avpkt->buf)
> > -        p->avpkt.buf = av_buffer_ref(avpkt->buf);
> > -    else {
> > -        av_fast_malloc(&p->buf, &p->allocated_buf_size, avpkt->size + 
> > FF_INPUT_BUFFER_PADDING_SIZE);
> > -        p->avpkt.data = p->buf;
> > -        memcpy(p->buf, avpkt->data, avpkt->size);
> > -        memset(p->buf + avpkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
> > -    }
> > +    av_packet_unref(&p->avpkt);
> > +    av_packet_ref(&p->avpkt, avpkt);
> 
> This breaks code which uses non ref-counted AVPacket and I suspect there are 
> still users of libavcodec which don't use ref-counted AVPackets. Users which 
> don't use lavformat are most likely. I can't find anything which says that 
> non ref-counted AVPackets are forbidden and av_init_packet is not marked as 
> deprecated.
> 

It should not break such code, av_packet_ref() falls back on alloc+memcpy for
non-refcounted packets.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to