[FFmpeg-devel] [PATCH 08/17] lavfi: add helpers to consume frames from link FIFOs.
Nicolas George
george at nsup.org
Sun Dec 25 12:44:07 EET 2016
Le quintidi 5 nivôse, an CCXXV, Michael Niedermayer a écrit :
> Whats your oppinion on using a explicit av_assert1() in the calling
> code for this ? (i assume it can be done easily&cleanly)
>
> It would explicitly in C code say what is meant, while a
> "_sure" requires additional knowledge specific to lavfi
You mean, in the caller, instead of:
ret = ff_link_consume_frame_sure(link, &frame);
write:
ret = ff_link_consume_frame(link, &frame);
av_assert1(ret >= 0);
Well, it loses us the property that ff_link_consume_frame_sure() cannot
fail at all (ff_link_consume_samples_sure() can, because it allocates
memory) and thus do not require getting the return value at all. But I
was not sure I wanted to make this a promise anyway.
Also, it adds extra tests: one in the code, one in consume() instead of
just one in the code (not counting the asserts, only present in debug
builds). But that is just my premature optimizer side talking.
Apart from that I am ok with it. It just requires documentation that
this is the recommended idiom.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161225/d66b1a97/attachment.sig>
More information about the ffmpeg-devel
mailing list