[FFmpeg-devel] avdevice/v4l2: Change assert type when format not supported

Submitted by Andriy Gelman on Nov. 3, 2019, 4:08 p.m.

Details

Message ID 20191103160841.14872-1-andriy.gelman@gmail.com
State New
Headers show

Commit Message

Andriy Gelman Nov. 3, 2019, 4:08 p.m.
From: Andriy Gelman <andriy.gelman@gmail.com>

Currently an av_assert0 is triggered when a target format is not
supported by a v4l2 device. Replace by av_assert1 to fix this issue.

Fixes #6629.
---
 libavdevice/v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas George Nov. 3, 2019, 4:37 p.m.
Andriy Gelman (12019-11-03):
> From: Andriy Gelman <andriy.gelman@gmail.com>
> 
> Currently an av_assert0 is triggered when a target format is not
> supported by a v4l2 device. Replace by av_assert1 to fix this issue.
> 
> Fixes #6629.

No. It does not fix it, it just hides it in non-devel builds.

Regards,
Andriy Gelman Nov. 3, 2019, 5:03 p.m.
On Sun, 03. Nov 17:37, Nicolas George wrote:
> Andriy Gelman (12019-11-03):
> > From: Andriy Gelman <andriy.gelman@gmail.com>
> > 
> > Currently an av_assert0 is triggered when a target format is not
> > supported by a v4l2 device. Replace by av_assert1 to fix this issue.
> > 
> > Fixes #6629.
> 
> No. It does not fix it, it just hides it in non-devel builds.

Fine with me if you want to change

"Replace by av_assert1 to fix this issue" -> "Replace by av_assert1 to hide in
non-devel builds"
Carl Eugen Hoyos Nov. 3, 2019, 5:22 p.m.
Am So., 3. Nov. 2019 um 18:03 Uhr schrieb Andriy Gelman
<andriy.gelman@gmail.com>:
>
> On Sun, 03. Nov 17:37, Nicolas George wrote:
> > Andriy Gelman (12019-11-03):
> > > From: Andriy Gelman <andriy.gelman@gmail.com>
> > >
> > > Currently an av_assert0 is triggered when a target format is not
> > > supported by a v4l2 device. Replace by av_assert1 to fix this issue.
> > >
> > > Fixes #6629.
> >
> > No. It does not fix it, it just hides it in non-devel builds.
>
> Fine with me if you want to change
>
> "Replace by av_assert1 to fix this issue" -> "Replace by av_assert1 to hide in
> non-devel builds"

To address this ticket, only a patch that changes behaviour no matter what
assertion level was chosen at build time is acceptable
(= fix the wrong condition, not the check or remove the check if it is wrong).

Carl Eugen

Patch hide | download patch | download mbox

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