From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Olivier Langlois <olivier@trillion01.com>
Cc: m.chehab@samsung.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, Stable <stable@vger.kernel.org>
Subject: Re: [PATCH] [media] uvcvideo: Fix clock param realtime setting
Date: Fri, 28 Mar 2014 17:20:13 +0100 [thread overview]
Message-ID: <16236471.uFSjvbT2di@avalon> (raw)
In-Reply-To: <1395985358-17047-1-git-send-email-olivier@trillion01.com>
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 ?
> ---
> drivers/media/usb/uvc/uvc_video.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c
> b/drivers/media/usb/uvc/uvc_video.c index 898c208..c79db33 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -361,6 +361,14 @@ static int uvc_commit_video(struct uvc_streaming
> *stream, * Clocks and timestamps
> */
>
> +static inline void uvc_video_get_ts(struct timespec *ts)
> +{
> + if (uvc_clock_param == CLOCK_MONOTONIC)
> + ktime_get_ts(ts);
> + else
> + ktime_get_real_ts(ts);
> +}
> +
> static void
> uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer
> *buf, const __u8 *data, int len)
> @@ -420,7 +428,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream,
> struct uvc_buffer *buf, stream->clock.last_sof = dev_sof;
>
> host_sof = usb_get_current_frame_number(stream->dev->udev);
> - ktime_get_ts(&ts);
> + uvc_video_get_ts(&ts);
>
> /* The UVC specification allows device implementations that can't obtain
> * the USB frame number to keep their own frame counters as long as they
> @@ -1011,10 +1019,7 @@ static int uvc_video_decode_start(struct
> uvc_streaming *stream,
> return -ENODATA;
> }
>
> - if (uvc_clock_param == CLOCK_MONOTONIC)
> - ktime_get_ts(&ts);
> - else
> - ktime_get_real_ts(&ts);
> + uvc_video_get_ts(&ts);
>
> buf->buf.v4l2_buf.sequence = stream->sequence;
> buf->buf.v4l2_buf.timestamp.tv_sec = ts.tv_sec;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-03-28 16:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 5:42 [PATCH] [media] uvcvideo: Fix clock param realtime setting Olivier Langlois
2014-03-28 16:20 ` Laurent Pinchart [this message]
2014-03-28 21:27 ` Olivier Langlois
2014-03-28 21:48 ` Laurent Pinchart
2014-03-29 2:50 ` Olivier Langlois
2014-03-30 4:23 ` Olivier Langlois
2014-04-01 13:49 ` Laurent Pinchart
2014-04-02 4:31 ` Olivier Langlois
2014-04-08 16:57 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16236471.uFSjvbT2di@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=olivier@trillion01.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).