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

Nicolas George george at nsup.org
Tue Oct 25 20:58:56 EEST 2016


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.

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.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161025/67d98100/attachment.sig>


More information about the ffmpeg-devel mailing list