[MPlayer-dev-eng] [PATCH] fix v4l2 free_demuxer crash - uvcvideo

Vladimir Voroshilov voroshil at gmail.com
Fri May 30 13:28:33 CEST 2008


2008/5/30 Ötvös Attila <dc at chello.hu>:
> Ezzel a dátummal: Friday 30 May 2008 09.46.06 Vladimir Voroshilov ezt írta:
> Hi Vladimir Voroshilov!
>
>> This means that drivers reports frameperiod==0.
>> I didn't found any requirenments for non-zero frameperiod in V4L2 spec
>> does, though.
>> But even if  such value is allowed (which sounds strange for me),
>> above solution is incomplete,
>> because frameperiod is used in other places, too (e.g. A/V sync code).
>>
>> Are here any v4l2 specialists?
>> What do you think ?
>>
>> Fixing uvcvideo drivers looks more reasonable, imho.
>
> Ok. I rewiev uvcvideo kernel module:
>
> ----- start cut from uvc_v4l2.c ----------
>        /* Analog video standards make no sense for digital cameras. */
>        case VIDIOC_ENUMSTD:
>        case VIDIOC_QUERYSTD:
>        case VIDIOC_G_STD:
>        case VIDIOC_S_STD:
>
>        case VIDIOC_OVERLAY:
>
>        case VIDIOC_ENUMAUDIO:
>        case VIDIOC_ENUMAUDOUT:
>
>        case VIDIOC_ENUMOUTPUT:
>                uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd);
>                return -EINVAL;
> ----- end cut from uvc_v4l2.c ----------
>
> I make new patch.
>

>@@ -438,9 +445,14 @@
>     int i=0;
>
>     if (ioctl(priv->video_fd, VIDIOC_G_STD, &id) < 0) {
>+        priv->parm.type=V4L2_BUF_TYPE_VIDEO_CAPTURE;
>+        if(ioctl(priv->video_fd, VIDIOC_G_PARM, &priv->parm) < 0) {
>         mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl get standard failed: %s\n",
>                info.short_name, strerror(errno));
>         return -1;
>+        }
>+        priv->noanalog=1;
>+        return 0;
>     }

if (ioctl(priv->video_fd, VIDIOC_G_STD, &id) < 0) {
   struct v4l2_streamparm      parm;

   /* Here is comment why ioctl below is required bla-bla-bla */
   parm.type=V4L2_BUF_TYPE_VIDEO_CAPTURE;
   if(ioctl(priv->video_fd, VIDIOC_G_PARM, &parm) >= 0) {
   {
       mp_msg(MSGT_TV, MSGL_WARN, "%s: your device driver does not
support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was
                 used instead.\n", info.short_name);
       priv->standard.index=0;
       priv->standard.id=0;
       priv->standard.frameperiod=parm.parm.capture.timeperframe;
       return 0;
    }

    mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl get standard failed: %s\n",
           info.short_name, strerror(errno));
    return -1;
}

And the rest of your patch is not needed.

P.S. i didn't test code above.
P.P.S i don't know how much "hackish" is either my or your solution.

-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719


More information about the MPlayer-dev-eng mailing list