lkml.org 
[lkml]   [2014]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] [media] uvcvideo: Fix clock param realtime setting
From
Date
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@trillion01.com>
> > Cc: Stable <stable@vger.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




\
 
 \ /
  Last update: 2014-03-28 23:21    [W:0.061 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site