gstreamer/subprojects/gst-plugins-bad/sys/v4l2codecs
Marek Vasut bc56f7f9b7 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/5850>
2024-01-18 19:36:25 +00:00
..
linux v4l2codecs: Align v4l2 headers with HEVC final uAPI 2022-07-22 10:21:02 -04: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
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 plugins: Fix various trivial clang compiler warnings 2023-03-18 19:52:40 +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-18 00:17:54 +00:00
gstv4l2codech265dec.h v4l2codecs: Add v4l2 stateless H265 decoder 2022-07-22 10:21:02 -04:00
gstv4l2codecmpeg2dec.c v4l2codecs: Allow output caps to be updated 2022-11-16 13:12:38 +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 2024-01-18 19:36:25 +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 v4l2codecs: Allow output caps to be updated 2022-11-16 13:12:38 +00:00
gstv4l2codecvp9dec.h v4l2codecs: vp9: Add alpha decodebin wrapper 2021-12-10 21:37:14 +00:00
gstv4l2decoder.c v4l2codecs: Avoid QBUF/DQBUF struct timeval .tv_usec wrap-around at frame 1000000 2023-11-04 16:59:51 +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 16:48:50 +01:00
gstv4l2format.h v4l2codecs: Add P010 pixel format 2022-06-13 16:44:29 +02:00
meson.build meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
plugin.c v4l2codecs: Add v4l2 stateless H265 decoder 2022-07-22 10:21:02 -04:00