summaryrefslogtreecommitdiff
path: root/libavcodec/v4l2_m2m.c
diff options
context:
space:
mode:
authorAndriy Gelman <andriy.gelman@gmail.com>2020-01-12 23:11:27 -0500
committerMark Thompson <sw@jkqxz.net>2020-02-01 21:39:05 +0000
commit4c1a3e91665c102136ded4a78310166e9eb99604 (patch)
tree3a631584b6ae3bc9ee44dfaafd6205cb128cd81a /libavcodec/v4l2_m2m.c
parent3905ecbc0670377e768cecf9a5e9be397b7a4e5a (diff)
avcodec/v4l2_m2m: Simplify capture buffer init check
Before this commit s->avctx == NULL was used to infer that an encoder is being initialzed. Code readability has been improved by directly using !av_codec_is_decoder() instead. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Diffstat (limited to 'libavcodec/v4l2_m2m.c')
-rw-r--r--libavcodec/v4l2_m2m.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 1112d71ead..b5a9fd1034 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -176,7 +176,7 @@ static int v4l2_configure_contexts(V4L2m2mContext* s)
}
/* decoder's buffers need to be updated at a later stage */
- if (!s->avctx || !av_codec_is_decoder(s->avctx->codec)) {
+ if (s->avctx && !av_codec_is_decoder(s->avctx->codec)) {
ret = ff_v4l2_context_init(&s->capture);
if (ret) {
av_log(log_ctx, AV_LOG_ERROR, "no v4l2 capture context's buffers\n");
@@ -307,7 +307,7 @@ int ff_v4l2_m2m_codec_full_reinit(V4L2m2mContext *s)
}
/* decoder's buffers need to be updated at a later stage */
- if (!s->avctx || !av_codec_is_decoder(s->avctx->codec)) {
+ if (s->avctx && !av_codec_is_decoder(s->avctx->codec)) {
ret = ff_v4l2_context_init(&s->capture);
if (ret) {
av_log(log_ctx, AV_LOG_ERROR, "no v4l2 capture context's buffers\n");