[FFmpeg-devel] [PATCH] lavd/xcbgrab: do not try to create refcounted packets.

Clément Bœsch u at pkh.me
Tue Oct 25 21:03:49 EEST 2016


On Tue, Oct 25, 2016 at 07:58:56PM +0200, Nicolas George wrote:
> Le quartidi 4 brumaire, an CCXXV, Clement Boesch a écrit :
> > > The framework will allocate a buffer and copy the data to it,
> > > that takes time.
> 
> > Sorry if this is a dumb question but: can you describe what happens if the
> > previous packet still held the same pkt->data = c->buffer?
> > 
> > That is, when and how the buffer copy does happen?
> > 
> > (no need for a av_buffer_create with RO flag?)
> 
> Not dumb, but the answer was in the first sentence of the commit message.
> 

I was wondering where and how,

> The corresponding code is in ff_read_packet():
> 
>         if (!pkt->buf) {
>             AVPacket tmp = { 0 };
>             ret = av_packet_ref(&tmp, pkt);
>             if (ret < 0)
>                 return ret;
>             *pkt = tmp;
>         }
> 
> And av_packet_ref() creates a refcounted buffer if the given one is not
> refcounted.

I see, that makes sense. Thanks for clarifying.

-- 
Clément B.


More information about the ffmpeg-devel mailing list