[FFmpeg-devel] v4l2: bug #1570 and possible solution

Giorgio Vazzana mywing81 at gmail.com
Tue Feb 12 18:01:10 CET 2013


2013/2/12 Michael Niedermayer <michaelni at gmx.at>:
> On Tue, Feb 12, 2013 at 12:40:21PM +0100, Giorgio Vazzana wrote:
>> 2013/2/12 Michael Niedermayer <michaelni at gmx.at>:
>> +static void mmap_release_buffer(AVPacket *pkt)
>> +{
>> +    struct buff_data *buf_descriptor = pkt->priv;
>> +
>> +    if (pkt->data == NULL)
>> +        return;
>> +
>> +    if (buf_descriptor->buffer_copied) {
>> +        av_free(pkt->data);
>> +    } else {
>> +        if (!enqueue_buffer(buf_descriptor->fd, buf_descriptor->index))
>
>> +            (*buf_descriptor->buffers_dequeued)--;
>
> the deallocation of packets could happen from different thread(s)
> so i think this needs either a mutex, an atomic decrement or some
> lockless algorithm to achive the same

Ok, I've tried to implement the solution using the mutex. Please comment.

We can use this approach, or the easiest (and slightly slower?)
solution would be copying every frame/buffer to the memory allocated
for the corresponding packet.

Giorgio Vazzana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavd-v4l2-copy-frames-into-normally-allocated-packet.patch
Type: application/octet-stream
Size: 5856 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130212/d520765f/attachment.obj>


More information about the ffmpeg-devel mailing list