[FFmpeg-devel] [PATCH 1/3] avutil/threadmessage: add av_thread_message_flush()
Clément Bœsch
u at pkh.me
Wed Dec 2 17:05:45 CET 2015
On Wed, Dec 02, 2015 at 04:59:15PM +0100, Nicolas George wrote:
[...]
> > + av_fifo_generic_peek_at(mq->fifo, mq->tmp_msg, off, mq->elsize, NULL);
> > + mq->free_func(mq->tmp_msg);
>
> Could this use av_fifo_generic_peek() to avoid the ugly extra allocation?
>
What would be the difference? both av_fifo_generic_peek and
av_fifo_generic_peek_at require a copy of the element in a destination
buffer, unless I'm missing something.
> > + }
> > + }
> > + av_fifo_drain(mq->fifo, used);
> > + pthread_cond_broadcast(&mq->cond);
> > + pthread_mutex_unlock(&mq->lock);
> > +#endif /* HAVE_THREADS */
> > +}
> > diff --git a/libavutil/threadmessage.h b/libavutil/threadmessage.h
> > index a8481d8..c59cb06 100644
> > --- a/libavutil/threadmessage.h
> > +++ b/libavutil/threadmessage.h
> > @@ -88,4 +88,16 @@ void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq,
> > void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
> > int err);
> >
> > +/**
> > + * Set the optional free message callback function which will be called if an
> > + * operation is removing messages from the queue.
> > + */
> > +int av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq,
> > + void (*free_func)(void *msg));
> > +
> > +/**
>
> > + * Flush the message queue
>
> I will not block for that, but I am still not satisfied with the
> explanations, and therefore I find this documentation insufficient. Maybe
> wait for other advice?
>
Sure, no problem.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151202/bedb4bcb/attachment.sig>
More information about the ffmpeg-devel
mailing list