[FFmpeg-cvslog] avdevice/v4l2: Remove av_assert0 when format not supported

Andriy Gelman git at videolan.org
Wed Nov 6 21:39:46 EET 2019


ffmpeg | branch: master | Andriy Gelman <andriy.gelman at gmail.com> | Mon Nov  4 22:32:59 2019 -0500| [7b2ce27e56cfb4c55490035283a687251061bb50] | committer: Michael Niedermayer

avdevice/v4l2: Remove av_assert0 when format not supported

Before this commit an av_assert0 would fail if a v4l2 device did not
support a target format.
For example,
./ffmpeg -f v4l2 -codec:v h264 -i /dev/video0 -f mpegts -
would signal an abort if /dev/video0 did not support h264.

The new behaviour is to return an AVERROR(EINVAL) error code. An
av_assert0 has been added to verify this return.

Fixes #6629

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavdevice/v4l2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 446a243cf8..365bacd771 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -811,7 +811,8 @@ static int device_try_init(AVFormatContext *ctx,
     }
 
     *codec_id = ff_fmt_v4l2codec(*desired_format);
-    av_assert0(*codec_id != AV_CODEC_ID_NONE);
+    if (*codec_id == AV_CODEC_ID_NONE)
+        av_assert0(ret == AVERROR(EINVAL));
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list