gstreamer/subprojects/gst-plugins-bad/sys/v4l2codecs
Marek Vasut 15c9a6caa9 vp8decoder: Fix multiplication wraparound
The GstVp8Picture system_frame_number is guint32, constant 1000 is guint32,
GstV4l2CodecVp8Dec v4l2_vp8_frame.*_frame_ts multiplication result is u64 .

```
u64 result = (u32)((u32)system_frame_number * (u32)1000);
```
behaves the same as
```
u64 result = (u32)(((u32)system_frame_number * (u32)1000) & 0xffffffff);
```

so in case `system_frame_number > 4294967295 / 1000`, the `result` will
wrap around. Since the `result` is really used as a cookie used to look
up V4L2 buffers related to the currently decoded frame, this wraparound
leads to visible corruption during VP8 decoding. At 30 FPS this occurs
after cca. 40 hours of playback .

Fix this by changing the 1000 from u32 to u64, i.e.:
```
u64 result = (u64)((u32)system_frame_number * (u64)1000ULL);
```
this way, the wraparound is prevented and the correct cookie is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5791>
2023-12-20 18:47:39 +00:00
..
linux v4l2codecs: Enable Mediatek 10bit 4:2:0 support 2023-08-08 16:08:16 +00:00
gstv4l2codecallocator.c v4l2codecs: Fix segfault when destroying non-detached allocator 2021-11-02 15:25:48 +00:00
gstv4l2codecallocator.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecalphadecodebin.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecalphadecodebin.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecav1dec.c v4l2codecs: av1: Fix typo in debug log message 2023-12-06 10:25:24 +00:00
gstv4l2codecav1dec.h v4l2codecs: Add AV1 decoder 2023-06-16 01:30:40 +00:00
gstv4l2codecdevice.c v4l2codecs: Warn user when no media devices are found 2022-09-29 19:12:14 +00:00
gstv4l2codecdevice.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codech264dec.c h264decoder: Port to GstCodecPicture struct 2023-09-08 11:51:23 +00:00
gstv4l2codech264dec.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codech265dec.c v4l2codecs: h265: Fix entry_point_offsets array leak 2023-10-17 15:06:26 -04:00
gstv4l2codech265dec.h v4l2codecs: Add v4l2 stateless H265 decoder 2022-07-22 10:21:02 -04:00
gstv4l2codecmpeg2dec.c mpeg2decoder: Port to GstCodecPicture struct 2023-09-08 11:51:23 +00:00
gstv4l2codecmpeg2dec.h v4l2codecs: mpeg2: Check that the decoder output formats 2021-12-10 21:37:14 +00:00
gstv4l2codecpool.c Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecpool.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecvp8dec.c vp8decoder: Fix multiplication wraparound 2023-12-20 18:47:39 +00:00
gstv4l2codecvp8dec.h Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstv4l2codecvp9dec.c vp9decoder: Port to GstCodecPicture struct 2023-09-08 11:51:23 +00:00
gstv4l2codecvp9dec.h v4l2codecs: vp9: Add alpha decodebin wrapper 2021-12-10 21:37:14 +00:00
gstv4l2decoder.c v4l2codecs: Query the right buffer before expbuf 2023-11-22 15:50:08 +00:00
gstv4l2decoder.h v4l2codecs: Trace request by it FD 2022-03-25 21:40:28 +00:00
gstv4l2format.c v4l2codecs: Fix tiled formats stride conversion 2023-10-11 14:13:53 +00:00
gstv4l2format.h v4l2codecs: Enable Mediatek 10bit 4:2:0 support 2023-08-08 16:08:16 +00:00
meson.build v4l2codecs: Add AV1 decoder 2023-06-16 01:30:40 +00:00
plugin.c v4l2codecs: Add AV1 decoder 2023-06-16 01:30:40 +00:00