mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
media: uvcvideo: Fix dev_sof filtering in hw timestamp
To avoid filling the clock circular buffer with duplicated data we only
add it if the new value sof is different than the last added sof.
The issue is that we compare the unprocess sof with the processed sof.
If there is a sof_offset, or UVC_QUIRK_INVALID_DEVICE_SOF is enabled,
the comparison will not work as expected.
This patch moves the comparison to the right place.
Fixes: 141270bd95 ("media: uvcvideo: Refactor clock circular buffer")
Cc: stable@vger.kernel.org
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Tested-by: Yunke Cao <yunkec@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20260513-uvc-hwtimestamp-v3-1-7a64838b0b02@chromium.org
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
a15b773fe4
commit
edc1917599
|
|
@ -583,16 +583,7 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
|
|||
if (!has_scr)
|
||||
return;
|
||||
|
||||
/*
|
||||
* To limit the amount of data, drop SCRs with an SOF identical to the
|
||||
* previous one. This filtering is also needed to support UVC 1.5, where
|
||||
* all the data packets of the same frame contains the same SOF. In that
|
||||
* case only the first one will match the host_sof.
|
||||
*/
|
||||
sample.dev_sof = get_unaligned_le16(&data[header_size - 2]);
|
||||
if (sample.dev_sof == stream->clock.last_sof)
|
||||
return;
|
||||
|
||||
sample.dev_stc = get_unaligned_le32(&data[header_size - 6]);
|
||||
|
||||
/*
|
||||
|
|
@ -664,6 +655,16 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
|
|||
}
|
||||
|
||||
sample.dev_sof = (sample.dev_sof + stream->clock.sof_offset) & 2047;
|
||||
|
||||
/*
|
||||
* To limit the amount of data, drop SCRs with an SOF identical to the
|
||||
* previous one. This filtering is also needed to support UVC 1.5, where
|
||||
* all the data packets of the same frame contains the same SOF. In that
|
||||
* case only the first one will match the host_sof.
|
||||
*/
|
||||
if (sample.dev_sof == stream->clock.last_sof)
|
||||
return;
|
||||
|
||||
uvc_video_clock_add_sample(&stream->clock, &sample);
|
||||
stream->clock.last_sof = sample.dev_sof;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user