aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Qian <ming.qian@nxp.com>2022-01-04 17:08:34 +0800
committerAndriy Gelman <andriy.gelman@gmail.com>2022-01-11 23:02:37 -0500
commit35a9307beb6c179a5e517c0d90d5991ed45c07ac (patch)
tree145e51c9b51c7ac81a2f0ecdcb73ded6ff72cf43
parent9c58fd22269c9784f1f97d7e4a30daf4e06917f8 (diff)
downloadffmpeg-35a9307beb6c179a5e517c0d90d5991ed45c07ac.tar.gz
avcodec/v4l2_context: remove reinit variable
Cleanup after commit 3fc72c9fc16df3b7edc329ed9eeaaa1e65976c33. Fixes coverity ticket #1497095. Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Ming Qian <ming.qian@nxp.com>
-rw-r--r--libavcodec/v4l2_context.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a181f884d2..e891649f92 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -178,7 +178,7 @@ static int v4l2_handle_event(V4L2Context *ctx)
V4L2m2mContext *s = ctx_to_m2mctx(ctx);
struct v4l2_format cap_fmt = s->capture.format;
struct v4l2_event evt = { 0 };
- int reinit, ret;
+ int ret;
ret = ioctl(s->fd, VIDIOC_DQEVENT, &evt);
if (ret < 0) {
@@ -200,8 +200,7 @@ static int v4l2_handle_event(V4L2Context *ctx)
return 0;
}
- reinit = v4l2_resolution_changed(&s->capture, &cap_fmt);
- if (reinit) {
+ if (v4l2_resolution_changed(&s->capture, &cap_fmt)) {
s->capture.height = v4l2_get_height(&cap_fmt);
s->capture.width = v4l2_get_width(&cap_fmt);
s->capture.sample_aspect_ratio = v4l2_get_sar(&s->capture);
@@ -210,28 +209,20 @@ static int v4l2_handle_event(V4L2Context *ctx)
return 0;
}
- if (reinit)
- s->reinit = 1;
+ s->reinit = 1;
- if (reinit) {
- if (s->avctx)
- ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height);
- if (ret < 0)
- av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and width\n");
+ if (s->avctx)
+ ret = ff_set_dimensions(s->avctx, s->capture.width, s->capture.height);
+ if (ret < 0)
+ av_log(logger(ctx), AV_LOG_WARNING, "update avcodec height and width\n");
- ret = ff_v4l2_m2m_codec_reinit(s);
- if (ret) {
- av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n");
- return AVERROR(EINVAL);
- }
- goto reinit_run;
+ ret = ff_v4l2_m2m_codec_reinit(s);
+ if (ret) {
+ av_log(logger(ctx), AV_LOG_ERROR, "v4l2_m2m_codec_reinit\n");
+ return AVERROR(EINVAL);
}
- /* dummy event received */
- return 0;
-
/* reinit executed */
-reinit_run:
return 1;
}