diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index c104ffe3b3c1..fc3536a4399f 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -645,8 +645,6 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, if (stream->dev->quirks & UVC_QUIRK_INVALID_DEVICE_SOF) sample.dev_sof = sample.host_sof; - sample.host_time = uvc_video_get_time(); - /* * The UVC specification allows device implementations that can't obtain * the USB frame number to keep their own frame counters as long as they @@ -687,6 +685,9 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, (UVC_MIN_HW_TIMESTAMP_DIFF / stream->clock.size)) return; + /* This is expensive, only do it if the sample will be added. */ + sample.host_time = uvc_video_get_time(); + uvc_video_clock_add_sample(&stream->clock, &sample); stream->clock.last_sof_processed = sample.dev_sof; }