lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1711768.4zHOjaJUg6@avalon>
Date:	Tue, 01 Apr 2014 15:49:54 +0200
From:	Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:	Olivier Langlois <olivier@...llion01.com>
Cc:	m.chehab@...sung.com, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org, Stable <stable@...r.kernel.org>
Subject: Re: [PATCH] [media] uvcvideo: Fix clock param realtime setting

Hi Olivier,

On Sunday 30 March 2014 00:23:01 Olivier Langlois wrote:
> Hi Laurent,
> 
> > > Yes. ffmpeg uses wall clock time to create timestamps for audio packets
> > > from ALSA device.
> > 
> > OK. I suppose I shouldn't drop support for the realtime clock like I
> > wanted to then :-)
> > 
> > > There is a bug in ffmpeg describing problems to synchronize audio and
> > > the video from a v4l2 webcam.
> > > 
> > > https://trac.ffmpeg.org/ticket/692
> > > 
> > > To workaround this issue, ffmpeg devs added a switch to convert back
> > > 
> > > monotonic to realtime. From ffmpeg/libavdevice/v4l2.c:
> > >   -ts                <int>        .D.... set type of timestamps for
> > >                                          grabbed frames (from 0 to 2)
> > >                                          (default 0)
> > >      default                      .D.... use timestamps from the kernel
> > >      abs                          .D.... use absolute timestamps (wall
> > >                                          clock)
> > >      mono2abs                     .D.... force conversion from monotonic
> > >                                          to absolute timestamps
> > > 
> > > If the v4l2 driver is able to send realtime ts, it is easier synchronize
> > > in userspace if all inputs use the same clock.
> > 
> > That might be a stupid question, but shouldn't ALSA use the monotonic
> > clock instead ?
> 
> I think that I have that answer why ffmpeg use realtime clock for ALSA data.
> In fact ffmpeg uses realtime clock for every data coming from capture
> devices and the purpose is to be able to seek into the recorded stream by
> using the date where the recording occured. Same principle than a camera
> recording dates when pictures are taken.
>
> now a tougher question is whether or not it is up to the driver to provide
> these realtime ts.

It makes sense to associate a wall time with recorded streams for that 
purpose, but synchronization should in my opinion be performed using the 
monotonic clock, as the wall time can jump around. I believe drivers should 
provide monotonic timestamps only. However, given that the uvcvideo driver has 
the option of providing wall clock timestamps, that option should work, so 
your patch makes sense. I'd still like to remove support for the wall clock 
though, but I don't want to break userspace. ffmpeg should be fixed, 
especially given that most V4L devices provide monotonic timestamps only.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ