gstreamer/subprojects/gst-plugins-bad/sys
Marek Vasut 2122cf512a mpeg2decoder: Fix multiplication wraparound
The GstMpeg2Picture system_frame_number is guint32, constant 1000 is guint32,
GstV4l2CodecMpeg2Dec *_ref_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 MPEG2 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
..
amfcodec amfav1enc: Set stream-format on caps 2023-02-15 11:14:12 +00:00
androidmedia androidmedia/enc: handle codec-data before popping GstVideoCodecFrames 2023-09-16 01:40:17 +00:00
applemedia applemedia: Also fix inconsistent pixel format definition for NV12 2023-09-18 19:42:22 +00:00
asio meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
bluez avdtputil: Use int instead of int range for fixed bitpool values 2023-05-17 09:27:04 +00:00
d3d11 d3d11: fix building with address sanitizer 2023-12-08 10:19:18 +00:00
d3dvideosink d3dvideosink: Fix navigation event leak 2023-06-15 10:39:32 +00:00
decklink decklink: Fix broken COM string conversion 2023-10-09 15:34:44 +01:00
directshow dshowdeviceprovider: Fix leak in gst_dshow_device_provider_start 2023-03-20 13:10:55 +00:00
directsound meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
dvb dvbbasebin: don't rely on g_key_file_get_(integer|uint64) return 2023-01-05 12:51:28 +00:00
fbdev meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
ipcpipeline meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
kms kmssink: Add TIDSS auto-detection 2023-10-15 23:17:29 +00:00
magicleap meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
mediafoundation mfvideoencoder: Fix typo in template caps 2023-10-26 00:40:56 +01:00
msdk msdkav1enc: fix the category for msdkav1enc debug 2023-02-18 11:48:08 +00:00
nvcodec nvdec: Fix division by zero when calculating buffer duration 2023-12-14 12:05:08 +00:00
opensles meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
qsv qsvdecoder: Fix stream format detection 2023-11-23 17:36:14 +00:00
shm meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
tinyalsa meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
uvch264 meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
v4l2codecs mpeg2decoder: Fix multiplication wraparound 2024-01-18 19:36:25 +00:00
va va: Fix in error logs functions mismatches 2023-09-16 17:57:33 +01:00
wasapi meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
wasapi2 wasapi2device: Ignore activation failed device 2023-11-06 13:19:13 +00:00
wic wic: Add since marker 2022-10-24 12:42:51 +00:00
win32ipc win32ipc: Fix pipe handle leak 2023-08-23 18:57:44 +01:00
winks taglist, plugins: fix compiler warnings with GLib >= 2.76 2023-07-12 08:58:50 +00:00
winscreencap winscreencap: Warn for deprecated plugin use 2022-12-08 17:48:11 +00:00
meson.build win32ipc: Add WIN32 shared memory videosrc/sink elements 2022-11-24 12:41:18 +00:00