Message ID | 20191101123343.7849-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
On Fri, Nov 01, 2019 at 01:33:43PM +0100, Michael Niedermayer wrote: > This compared to the other suggestions is cleaner and easier to understand > keeping the condition in the if() simple. > > This affects alot of fate tests. > > See: [FFmpeg-devel] [PATCH 05/11] avformat/nutenc: Don't pass NULL to memcmp > See: [FFmpeg-devel] [PATCH]lavf/nutenc: Do not call memcmp() with NULL argument > > Fixes: Ticket 7980 > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/nutenc.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) will apply [...]
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index d212f0c245..46dce7722d 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -792,11 +792,12 @@ static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc, flags |= FLAG_CHECKSUM; if (FFABS(pkt->pts - nus->last_pts) > nus->max_pts_distance) flags |= FLAG_CHECKSUM; - if (pkt->size < nut->header_len[fc->header_idx] || - (pkt->size > 4096 && fc->header_idx) || - memcmp(pkt->data, nut->header[fc->header_idx], - nut->header_len[fc->header_idx])) - flags |= FLAG_HEADER_IDX; + if (fc->header_idx) + if (pkt->size < nut->header_len[fc->header_idx] || + pkt->size > 4096 || + memcmp(pkt->data, nut->header [fc->header_idx], + nut->header_len[fc->header_idx])) + flags |= FLAG_HEADER_IDX; return flags | (fc->flags & FLAG_CODED); }
This compared to the other suggestions is cleaner and easier to understand keeping the condition in the if() simple. This affects alot of fate tests. See: [FFmpeg-devel] [PATCH 05/11] avformat/nutenc: Don't pass NULL to memcmp See: [FFmpeg-devel] [PATCH]lavf/nutenc: Do not call memcmp() with NULL argument Fixes: Ticket 7980 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/nutenc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)