[FFmpeg-devel] [PATCH] Implement NewTek NDI support
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Jul 23 15:48:10 EEST 2017
On 23.07.2017, at 12:20, Nicolas George <george at nsup.org> wrote:
>
>> + if (!q->last_pkt) {
>> + q->first_pkt = pkt1;
>> + } else {
>> + q->last_pkt->next = pkt1;
>> + }
If kept, I would invert the condition, otherwise the else is essentially a double-negation.
>> + q->last_pkt = pkt1;
>
> There is a little known but nice simplification when implementing
> linked-lists like that: instead of "last_pkt", have in the structure
> "AVPacketList **tail", and you can write this whole block without a
> condition:
>
> *q->tail = pkt1;
> q->tail = &(*q->tail)->next;
It's without condition and an optimization, I am not sure it quite qualifies as "simplification" though.
More information about the ffmpeg-devel
mailing list