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: <1396042028.3383.34.camel@Wailaba2>
Date:	Fri, 28 Mar 2014 17:27:08 -0400
From:	Olivier Langlois <olivier@...llion01.com>
To:	Laurent Pinchart <laurent.pinchart@...asonboard.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 Laurent,


On Fri, 2014-03-28 at 17:20 +0100, Laurent Pinchart wrote:
> Hi Olivier,
> 
> Thank you for the patch.
> 
> On Friday 28 March 2014 01:42:38 Olivier Langlois wrote:
> > timestamps in v4l2 buffers returned to userspace are updated in
> > uvc_video_clock_update() which uses timestamps fetched from
> > uvc_video_clock_decode() by calling unconditionally ktime_get_ts().
> > 
> > Hence setting the module clock param to realtime have no effect
> > before this patch.
> > 
> > This has been tested with ffmpeg:
> > 
> > ffmpeg -y -f v4l2 -input_format yuyv422 -video_size 640x480 -framerate 30 -i
> > /dev/video0 \ -f alsa -acodec pcm_s16le -ar 16000 -ac 1 -i default \
> >  -c:v libx264 -preset ultrafast \
> >  -c:a libfdk_aac \
> >  out.mkv
> > 
> > and inspecting the v4l2 input starting timestamp.
> > 
> > Signed-off-by: Olivier Langlois <olivier@...llion01.com>
> > Cc: Stable <stable@...r.kernel.org>
> 
> Before applying this, I'm curious, do you have a use case for realtime time 
> stamps ?
> 

Yes. ffmpeg uses wall clock time to create timestamps for audio packets
from ALSA device.

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.

Greetings,
Olivier


--
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