[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Possible bug in v4lv2_try_format function

From: Horváth Gergő
Subject: [Linphone-developers] Possible bug in v4lv2_try_format function
Date: Mon, 18 May 2015 00:12:33 +0200

Hi Everyone!

I'm currently in the middle of the development of a v4l2 camera driver, which doesn't have support for YUV420p.
While using linphone with this driver i noticed, that linphone is still trying to use YUV420p format, even though there's a check to confirm if the format is available.

The problem is, v4l2_try_format function is only checking if the VIDIOC_TRY_FMT ioctl returns with non-zero. This ioctl should return non-zero only if the type is invalid (or something bad happens). In the case of a not supported format, the driver have to propose a valid format in the same v4l2_format struct and return with zero.

A simple fix would be:

From 1edabe9c527f4a28a3770ec682e3c719a9e2d2b2 Mon Sep 17 00:00:00 2001
From: Gergo Horvath <address@hidden>
Date: Sun, 17 May 2015 23:59:25 +0200
Subject: [PATCH] fix Check the result of VIDIOC_TRY_FMT correctly

 src/videofilters/msv4l2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/videofilters/msv4l2.c b/src/videofilters/msv4l2.c
index d143aca..2574791 100644
--- a/src/videofilters/msv4l2.c
+++ b/src/videofilters/msv4l2.c
@@ -120,6 +120,7 @@ static bool_t v4lv2_try_format( V4l2State *s, struct v4l2_format *fmt, int fmtid
         ms_message("VIDIOC_TRY_FMT: %s",strerror(errno));
         return FALSE;
+    if (fmt->fmt.pix.pixelformat != fmtid) return FALSE;
     if (v4l2_ioctl (s->fd, VIDIOC_S_FMT, fmt)<0){
         ms_message("VIDIOC_S_FMT: %s",strerror(errno));
         return FALSE;

Best regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]