[FFmpeg-cvslog] fftools/ffmpeg_enc: Remove always-true checks

Andreas Rheinhardt git at videolan.org
Mon Jul 17 17:31:24 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jul 16 16:09:57 2023 +0200| [bfe15b81b317bc859223d6804f768ecda7b73db3] | committer: Andreas Rheinhardt

fftools/ffmpeg_enc: Remove always-true checks

frame is always != NULL for audio and video here
(this is checked by an assert and the frame is already dereferenced
before it reaches this code here).
Fixes Coverity issue #1538858.

Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfe15b81b317bc859223d6804f768ecda7b73db3
---

 fftools/ffmpeg_enc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 1489b2f179..2c7e29af24 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -304,20 +304,17 @@ int enc_open(OutputStream *ost, AVFrame *frame)
             enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample,
                                                  av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
 
-        if (frame) {
             enc_ctx->color_range            = frame->color_range;
             enc_ctx->color_primaries        = frame->color_primaries;
             enc_ctx->color_trc              = frame->color_trc;
             enc_ctx->colorspace             = frame->colorspace;
             enc_ctx->chroma_sample_location = frame->chroma_location;
-        }
 
         enc_ctx->framerate = fr;
 
         ost->st->avg_frame_rate = fr;
 
         // Field order: autodetection
-        if (frame) {
             if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&
                 ost->top_field_first >= 0)
                 if (ost->top_field_first)
@@ -332,7 +329,6 @@ int enc_open(OutputStream *ost, AVFrame *frame)
                     enc_ctx->field_order = (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? AV_FIELD_TB:AV_FIELD_BT;
             } else
                 enc_ctx->field_order = AV_FIELD_PROGRESSIVE;
-        }
 
         // Field order: override
         if (ost->top_field_first == 0) {



More information about the ffmpeg-cvslog mailing list