Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gstreamer-plugins-bad for openSUSE:Factory checked in at 2024-02-02 15:44:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gstreamer-plugins-bad (Old) and /work/SRC/openSUSE:Factory/.gstreamer-plugins-bad.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gstreamer-plugins-bad" Fri Feb 2 15:44:48 2024 rev:161 rq:1143425 version:1.22.9 Changes: -------- --- /work/SRC/openSUSE:Factory/gstreamer-plugins-bad/gstreamer-plugins-bad.changes 2024-01-25 18:39:38.635314780 +0100 +++ /work/SRC/openSUSE:Factory/.gstreamer-plugins-bad.new.1815/gstreamer-plugins-bad.changes 2024-02-02 15:44:58.883717727 +0100 @@ -1,0 +2,19 @@ +Thu Feb 1 10:56:39 UTC 2024 - Antonio Larrosa <alarr...@suse.com> + +- Update to version 1.22.9: + + av1parser: Fix potential stack overflow during tile list + parsing (CVE-2024-0444, bsc#1219453, ZDI-CAN-22300) + + camerabin: Correctly relink viewfinderbin_queue + + GstPlay: Fix error details parsing + + h264decoder: Handle malformed avc/avc3 packets + + h264decoder: h265decoder: Align with wraparound fix + + vp8decoder: vp9decoder: av1decoder: mpeg2decoder: + Fix multiplication wraparound + + vah264enc/vah264dec issues after recent upgrade to 1.22.8 + from 1.22.7 + + va: fixes for Mesa Gallium drivers in Mesa versions older + than v23.2 + + vp9parse: Fix critical warning during caps negotiation +- Rebase reduce-required-meson.patch + +------------------------------------------------------------------- Old: ---- gst-plugins-bad-1.22.8.tar.xz New: ---- gst-plugins-bad-1.22.9.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gstreamer-plugins-bad.spec ++++++ --- /var/tmp/diff_new_pack.Cp3g4W/_old 2024-02-02 15:44:59.503740184 +0100 +++ /var/tmp/diff_new_pack.Cp3g4W/_new 2024-02-02 15:44:59.503740184 +0100 @@ -73,7 +73,7 @@ %endif Name: gstreamer-plugins-bad -Version: 1.22.8 +Version: 1.22.9 Release: 0 Summary: GStreamer Streaming-Media Framework Plug-Ins License: LGPL-2.1-or-later ++++++ gst-plugins-bad-1.22.8.tar.xz -> gst-plugins-bad-1.22.9.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/ChangeLog new/gst-plugins-bad-1.22.9/ChangeLog --- old/gst-plugins-bad-1.22.8/ChangeLog 2023-12-18 13:16:13.125439600 +0100 +++ new/gst-plugins-bad-1.22.9/ChangeLog 2024-01-24 19:26:52.277854400 +0100 @@ -1,3 +1,203 @@ +=== release 1.22.9 === + +2024-01-24 18:21:13 +0000 Tim-Philipp Müller <t...@centricular.com> + + * NEWS: + * RELEASE: + * gst-plugins-bad.doap: + * meson.build: + Release 1.22.9 + +2024-01-24 12:36:48 +0000 Philippe Normand <ph...@igalia.com> + + * gst/videoparsers/gstvp9parse.c: + vp9parse: Fix critical warning during caps negotiation + `gst_pad_get_allowed_caps()` returns a non-writable caps, so we need to make it + writable, otherwise the `gst_caps_remove_structure()` call below might trigger a + critical warning. + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5976> + +2024-01-10 03:33:59 +0900 Seungha Yang <seun...@centricular.com> + + * gst-libs/gst/codecparsers/gstav1parser.c: + av1parser: Fix potential stack overflow during tile list parsing + The tile_count_minus_1 must be less than or equal to 511 as specified + in spec "6.11.1 General tile list OBU semantics" + Fixes #3214 / CVE-2024-0444 / ZDI-CAN-22873 + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5971> + +2023-12-06 21:25:44 +0900 Seungha Yang <seun...@centricular.com> + + * gst-libs/gst/codecs/gsth264decoder.c: + h264decoder: Handle malformed avc/avc3 packets + Packetized stream format should not contain start-code prefix + in bitstream and each [nal-length-byte, nal-byte] unit should consist of + single nal unit. But there are malformed streams in the world. + Use newly added gst_h264_parser_identify_and_split_nalu_avc() + method to identify each nal unit. + Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3219 + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5934> + +2023-12-06 21:23:08 +0900 Seungha Yang <seun...@centricular.com> + + * gst-libs/gst/codecparsers/gsth264parser.c: + * gst-libs/gst/codecparsers/gsth264parser.h: + * tests/check/libs/h264parser.c: + h264parser: Add gst_h264_parser_identify_and_split_nalu_avc() method + Equivalent to _split_nalu_hevc() method in h265parser. This method + will scan start-code prefix and split into individual NAL units + if start-code prefix is detected + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5934> + +2023-12-09 16:26:22 +0100 Marek Vasut <ma...@denx.de> + + * sys/v4l2codecs/gstv4l2codecmpeg2dec.c: + 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> + +2023-12-09 16:08:31 +0100 Marek Vasut <ma...@denx.de> + + * sys/v4l2codecs/gstv4l2codecvp9dec.c: + vp9decoder: Fix multiplication wraparound + The GstVp9Picture system_frame_number is guint32, constant 1000 is guint32, + GstV4l2CodecVp9Dec v4l2_vp9_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 VP9 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> + +2023-12-09 16:08:31 +0100 Marek Vasut <ma...@denx.de> + + * sys/v4l2codecs/gstv4l2codecvp8dec.c: + 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> + +2023-12-11 15:26:11 +0100 VÃctor Manuel Jáquez Leal <vjaq...@igalia.com> + + * gst-libs/gst/va/gstvaallocator.c: + vaallocator: only i965 can switch derived/non-derived at mapping + Since newer drivers change the strides and offset, and they have to be defined + at allocation time because those parameters are stored in the GstVideoMeta in + the buffer pool. + Thinks patch is based on commit 6b1fba14 and commit 809a984b + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5778> + +2023-07-13 16:56:56 +0800 Mengkejiergeli Ba <mengkejiergeli...@intel.com> + + * gst-libs/gst/va/gstvaallocator.c: + vaallocator: let pool alloc_info be consitent with the test order in gst_va_allocator_try + In gst_va_allocator_try, the first try is to use derive_image, if it + succeeds, we should use info from derived image to create bufferpool. + If derive fails, then try create_image and give created image info + to the pool. + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5778> + +2023-12-04 20:05:48 +0100 VÃctor Manuel Jáquez Leal <vjaq...@igalia.com> + + * gst-libs/gst/va/gstvaallocator.c: + vaallocator: force non-derived for old mesa drivers + Mesa <23.3 can't map derived images for P010 format. This patch forces + non-derived if this is the case. + See: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381 + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5778> + +2023-11-30 16:52:02 +0100 VÃctor Manuel Jáquez Leal <vjaq...@igalia.com> + + * gst-libs/gst/va/vasurfaceimage.c: + va: check surface status before get derive image + According with documentation the surface has to be in ready state before getting + it derived image. This patch adds that check. + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5778> + +2023-11-30 12:00:27 +0100 VÃctor Manuel Jáquez Leal <vjaq...@igalia.com> + + * gst-libs/gst/va/gstvaallocator.c: + vaallocator: don't fail if drm fourcc are different + When exporting a DMABuf from a VASurface the user might tell that the surface + was allocated with certain fourcc, but the returned VADRMPRIMESurfaceDescriptor + migth tell a different fourcc, as in the case or radeonsi driver, for duplicated + fourcc, such as YUY2 and YUYV. + Originally it was supposed to be a failed exportation. This patch relax this + validation by allowing different fourcc. + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5778> + +2023-11-18 18:51:04 +0100 Robert Mader <robert.ma...@collabora.com> + + * gst/camerabin2/gstcamerabin2.c: + camerabin: Correctly relink viewfinderbin_queue + This reverts a part of de92a6c7f2. Unlike `image_filter` and + `video_filter`, `viewfinder_filter` does not get linked to `src` but + `viewfinderbin_queue`. Thus the fix in the mentioned commit does not + apply for it and should be reverted. + This was not spotted earlier as only the other filters are used in + the project that uncovered the issue. + Fixes: de92a6c7f2 ("camerabin: Fix source updates with user filters") + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5842> + +2023-12-18 17:01:36 +0000 Philippe Normand <ph...@igalia.com> + + * gst-libs/gst/play/gstplay.c: + play: Fix error details parsing + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5831> + +2023-12-18 13:52:12 +0000 Tim-Philipp Müller <t...@centricular.com> + + * meson.build: + Back to development + Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5826> + === release 1.22.8 === 2023-12-18 12:09:37 +0000 Tim-Philipp Müller <t...@centricular.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/NEWS new/gst-plugins-bad-1.22.9/NEWS --- old/gst-plugins-bad-1.22.8/NEWS 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/NEWS 2024-01-24 19:21:13.000000000 +0100 @@ -2736,6 +2736,131 @@ - List of Merge Requests applied in 1.22.8 - List of Issues fixed in 1.22.8 +1.22.9 + +The ninth 1.22 bug-fix release (1.22.9) was released on 24 January 2024. + +This release only contains bugfixes and security fixes and it should be +safe to update from 1.22.x. + +Highlighted bugfixes in 1.22.9 + +- More Security fixes for the AV1 video codec parser +- va: fixes for Mesa Gallium drivers in Mesa versions older than v23.2 +- v4l2src: Consider framerate during caps selection +- v4l2codec: decoder fixes +- rtspsrc: multicast fixes +- camerabin viewfinder fixes +- various bug fixes, build fixes, memory leak fixes, and other + stability and reliability improvements + +gstreamer + +- aggregator: fix use-after-free in queries processing +- multiqueue: Ignore queue fullness for most events + +gst-plugins-base + +- audiobasesink: Donât wait on gap events +- audioconvert: change gst_audio_convert_get_unit_size() log levels +- glcolorconvert: Correct transform_caps direction +- gloverlay: Apply updated overlay coordinates correctly +- videorate: keep pool if max_buffers is unlimited + +gst-plugins-good + +- rtpsession: Only warn once if configured latency needs to be known + but isnât yet +- rtphdrext-clientaudiolevel: Fix level value being written by the + extension +- rtspsrc: set multicast-iface on udpsinks and fix RTCP sink TTL +- v4l2object: clear old fds when initializing poll during opening v4l2 + device +- v4l2src: Consider framerate during caps selection +- vpxdec: Use appropriate domain and code for decoding errors + +gst-plugins-bad + +- av1parser: Fix potential stack overflow during tile list parsing +- camerabin: Correctly relink viewfinderbin_queue +- GstPlay: Fix error details parsing +- h264decoder: Handle malformed avc/avc3 packets +- h264decoder: h265decoder: Align with wraparound fix +- vp8decoder: vp9decoder: av1decoder: mpeg2decoder: Fix multiplication + wraparound +- vah264enc/vah264dec issues after recent upgrade to 1.22.8 from + 1.22.7 +- va: fixes for Mesa Gallium drivers in Mesa versions older than v23.2 +- vp9parse: Fix critical warning during caps negotiation + +gst-plugins-ugly + +- No changes + +gst-plugins-rs + +- No changes + +gst-libav + +- No changes + +gst-rtsp-server + +- No changes + +gstreamer-vaapi + +- No changes + +gstreamer-sharp + +- No changes + +gst-omx + +- No changes + +gst-python + +- No changes + +gst-editing-services + +- No changes + +gst-validate + gst-integration-testsuites + +- No changes + +gst-examples + +- No changes + +Development build environment + +- No changes + +Cerbero build tool and packaging changes in 1.22.9 + +- No changes + +Contributors to 1.22.9 + +Alexander Slobodeniuk, Chao Guo, Damian Hobson-Garcia, Dan Searles, +Guillaume Desmottes, Jan Schmidt, Marek Vasut, Mengkejiergeli Ba, +Michael Tretter, Philippe Normand, Robert Mader, Sanchayan Maity, +Sebastian Dröge, Seungha Yang, Tim-Philipp Müller, VÃctor Manuel Jáquez +Leal, Xavier Claessens, + +⦠and many others who have contributed bug reports, translations, sent +suggestions or helped testing. Thank you all! + +List of merge requests and issues fixed in 1.22.9 + +- List of Merge Requests applied in 1.22.9 +- List of Issues fixed in 1.22.9 + Schedule for 1.24 Our next major feature release will be 1.24, and 1.23 will be the @@ -2743,7 +2868,7 @@ development of 1.23/1.24 will happen in the git main branch of the GStreamer mono repository. -The plan for the 1.24 development cycle is yet to be confirmed. +The target for an initial 1.24 release is February 2024. 1.24 will be backwards-compatible to the stable 1.22, 1.20, 1.18, 1.16, 1.14, 1.12, 1.10, 1.8, 1.6, 1.4, 1.2 and 1.0 release series. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/RELEASE new/gst-plugins-bad-1.22.9/RELEASE --- old/gst-plugins-bad-1.22.8/RELEASE 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/RELEASE 2024-01-24 19:21:13.000000000 +0100 @@ -1,4 +1,4 @@ -This is GStreamer gst-plugins-bad 1.22.8. +This is GStreamer gst-plugins-bad 1.22.9. The GStreamer team is thrilled to announce a new major feature release of your favourite cross-platform multimedia framework! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst/camerabin2/gstcamerabin2.c new/gst-plugins-bad-1.22.9/gst/camerabin2/gstcamerabin2.c --- old/gst-plugins-bad-1.22.8/gst/camerabin2/gstcamerabin2.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst/camerabin2/gstcamerabin2.c 2024-01-24 19:21:13.000000000 +0100 @@ -1751,20 +1751,11 @@ "notify::ready-for-capture", G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera); - if (camera->viewfinder_filter) { - if (!gst_element_link_pads (camera->src, "vfsrc", - camera->viewfinder_filter, NULL)) { - GST_ERROR_OBJECT (camera, - "Failed to link camera source's vfsrc pad to viewfinder filter"); - goto fail; - } - } else { - if (!gst_element_link_pads (camera->src, "vfsrc", - camera->viewfinderbin_queue, "sink")) { - GST_ERROR_OBJECT (camera, - "Failed to link camera source's vfsrc pad to viewfinder queue"); - goto fail; - } + if (!gst_element_link_pads (camera->src, "vfsrc", + camera->viewfinderbin_queue, "sink")) { + GST_ERROR_OBJECT (camera, + "Failed to link camera source's vfsrc pad to viewfinder queue"); + goto fail; } if (camera->image_filter) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst/videoparsers/gstvp9parse.c new/gst-plugins-bad-1.22.9/gst/videoparsers/gstvp9parse.c --- old/gst-plugins-bad-1.22.8/gst/videoparsers/gstvp9parse.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst/videoparsers/gstvp9parse.c 2024-01-24 19:21:13.000000000 +0100 @@ -290,6 +290,7 @@ /* concentrate on leading structure, since decodebin parser * capsfilter always includes parser template caps */ if (caps) { + caps = gst_caps_make_writable (caps); while (gst_caps_get_size (caps) > 0) { GstStructure *s = gst_caps_get_structure (caps, 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gstav1parser.c new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gstav1parser.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gstav1parser.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gstav1parser.c 2024-01-24 19:21:13.000000000 +0100 @@ -4347,6 +4347,13 @@ tile_list->output_frame_width_in_tiles_minus_1 = AV1_READ_BITS (br, 8); tile_list->output_frame_height_in_tiles_minus_1 = AV1_READ_BITS (br, 8); tile_list->tile_count_minus_1 = AV1_READ_BITS (br, 16); + if (tile_list->tile_count_minus_1 + 1 > GST_AV1_MAX_TILE_COUNT) { + GST_WARNING ("Invalid tile_count_minus_1 %d", + tile_list->tile_count_minus_1); + retval = GST_AV1_PARSER_BITSTREAM_ERROR; + goto error; + } + for (tile = 0; tile <= tile_list->tile_count_minus_1; tile++) { if (AV1_REMAINING_BITS (br) < 8 + 8 + 8 + 16) { retval = GST_AV1_PARSER_NO_MORE_DATA; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gsth264parser.c new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gsth264parser.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gsth264parser.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gsth264parser.c 2024-01-24 19:21:13.000000000 +0100 @@ -1652,6 +1652,179 @@ } /** + * gst_h264_parser_identify_and_split_nalu_avc: + * @nalparser: a #GstH264NalParser + * @data: The data to parse, containing an AVC coded NAL unit + * @offset: the offset in @data from which to parse the NAL unit + * @size: the size of @data + * @nal_length_size: the size in bytes of the AVC nal length prefix. + * @nalus: a caller allocated GArray of #GstH264NalUnit where to store parsed nal headers + * @consumed: (out): the size of consumed bytes + * + * Parses @data for packetized (e.g., avc/avc3) bitstream and + * sets @nalus. In addition to nal identifying process, + * this method scans start-code prefix to split malformed packet into + * actual nal chunks. + * + * Returns: a #GstH264ParserResult + * + * Since: 1.22.9 + */ +GstH264ParserResult +gst_h264_parser_identify_and_split_nalu_avc (GstH264NalParser * nalparser, + const guint8 * data, guint offset, gsize size, guint8 nal_length_size, + GArray * nalus, gsize * consumed) +{ + GstBitReader br; + guint nalu_size; + guint remaining; + guint off; + guint sc_size; + + g_return_val_if_fail (data != NULL, GST_H264_PARSER_ERROR); + g_return_val_if_fail (nalus != NULL, GST_H264_PARSER_ERROR); + g_return_val_if_fail (nal_length_size > 0 && nal_length_size < 5, + GST_H264_PARSER_ERROR); + + g_array_set_size (nalus, 0); + + if (consumed) + *consumed = 0; + + /* Would overflow guint below otherwise: the callers needs to ensure that + * this never happens */ + if (offset > G_MAXUINT32 - nal_length_size) { + GST_WARNING ("offset + nal_length_size overflow"); + return GST_H264_PARSER_BROKEN_DATA; + } + + if (size < offset + nal_length_size) { + GST_DEBUG ("Can't parse, buffer has too small size %" G_GSIZE_FORMAT + ", offset %u", size, offset); + return GST_H264_PARSER_ERROR; + } + + /* Read nal unit size and unwrap the size field */ + gst_bit_reader_init (&br, data + offset, size - offset); + nalu_size = gst_bit_reader_get_bits_uint32_unchecked (&br, + nal_length_size * 8); + + if (nalu_size < 1) { + GST_WARNING ("too small nal size %d", nalu_size); + return GST_H264_PARSER_BROKEN_DATA; + } + + if (size < (gsize) nalu_size + nal_length_size) { + GST_WARNING ("larger nalu size %d than data size %" G_GSIZE_FORMAT, + nalu_size + nal_length_size, size); + return GST_H264_PARSER_BROKEN_DATA; + } + + if (consumed) + *consumed = nalu_size + nal_length_size; + + off = offset + nal_length_size; + remaining = nalu_size; + sc_size = nal_length_size; + + /* Drop trailing start-code since it will not be scanned */ + if (remaining >= 3) { + if (data[off + remaining - 1] == 0x01 && data[off + remaining - 2] == 0x00 + && data[off + remaining - 3] == 0x00) { + remaining -= 3; + + /* 4 bytes start-code */ + if (remaining > 0 && data[off + remaining - 1] == 0x00) + remaining--; + } + } + + /* Looping to split malformed nal units. nal-length field was dropped above + * so expected bitstream structure are: + * + * <complete nalu> + * | nalu | + * sc scan result will be -1 and handled in CONDITION-A + * + * <nalu with startcode prefix> + * | SC | nalu | + * Hit CONDITION-C first then terminated in CONDITION-A + * + * <first nal has no startcode but others have> + * | nalu | SC | nalu | ... + * CONDITION-B handles those cases + */ + do { + GstH264NalUnit nalu; + gint sc_offset = -1; + guint skip_size = 0; + + memset (&nalu, 0, sizeof (GstH264NalUnit)); + + /* startcode 3 bytes + minimum nal size 1 */ + if (remaining >= 4) + sc_offset = scan_for_start_codes (data + off, remaining); + + if (sc_offset < 0) { + if (remaining >= 1) { + /* CONDITION-A */ + /* Last chunk */ + nalu.size = remaining; + nalu.sc_offset = off - sc_size; + nalu.offset = off; + nalu.data = (guint8 *) data; + nalu.valid = TRUE; + + gst_h264_parse_nalu_header (&nalu); + g_array_append_val (nalus, nalu); + } + break; + } else if ((sc_offset == 2 && data[off + sc_offset - 1] != 0) + || sc_offset > 2) { + /* CONDITION-B */ + /* Found trailing startcode prefix */ + + nalu.size = sc_offset; + if (data[off + sc_offset - 1] == 0) { + /* 4 bytes start code */ + nalu.size--; + } + + nalu.sc_offset = off - sc_size; + nalu.offset = off; + nalu.data = (guint8 *) data; + nalu.valid = TRUE; + + gst_h264_parse_nalu_header (&nalu); + g_array_append_val (nalus, nalu); + } else { + /* CONDITION-C */ + /* startcode located at beginning of this chunk without actual nal data. + * skip this start code */ + } + + skip_size = sc_offset + 3; + if (skip_size >= remaining) + break; + + /* no more nal-length bytes but 3bytes startcode */ + sc_size = 3; + if (sc_offset > 0 && data[off + sc_offset - 1] == 0) + sc_size++; + + remaining -= skip_size; + off += skip_size; + } while (remaining >= 1); + + if (nalus->len > 0) + return GST_H264_PARSER_OK; + + GST_WARNING ("No nal found"); + + return GST_H264_PARSER_BROKEN_DATA; +} + +/** * gst_h264_parser_parse_nal: * @nalparser: a #GstH264NalParser * @nalu: The #GstH264NalUnit to parse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gsth264parser.h new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gsth264parser.h --- old/gst-plugins-bad-1.22.8/gst-libs/gst/codecparsers/gsth264parser.h 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/codecparsers/gsth264parser.h 2024-01-24 19:21:13.000000000 +0100 @@ -1382,6 +1382,15 @@ GstH264NalUnit *nalu); GST_CODEC_PARSERS_API +GstH264ParserResult gst_h264_parser_identify_and_split_nalu_avc (GstH264NalParser *nalparser, + const guint8 *data, + guint offset, + gsize size, + guint8 nal_length_size, + GArray * nalus, + gsize * consumed); + +GST_CODEC_PARSERS_API GstH264ParserResult gst_h264_parser_parse_nal (GstH264NalParser *nalparser, GstH264NalUnit *nalu); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/codecs/gsth264decoder.c new/gst-plugins-bad-1.22.9/gst-libs/gst/codecs/gsth264decoder.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/codecs/gsth264decoder.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/codecs/gsth264decoder.c 2024-01-24 19:21:13.000000000 +0100 @@ -148,6 +148,9 @@ GArray *ref_pic_list0; GArray *ref_pic_list1; + /* Split packetized data into actual nal chunks (for malformed stream) */ + GArray *split_nalu; + /* For delayed output */ GstQueueArray *output_queue; @@ -387,6 +390,8 @@ priv->ref_pic_list1 = g_array_sized_new (FALSE, TRUE, sizeof (GstH264Picture *), 32); + priv->split_nalu = g_array_new (FALSE, FALSE, sizeof (GstH264NalUnit)); + priv->output_queue = gst_queue_array_new_for_struct (sizeof (GstH264DecoderOutputFrame), 1); gst_queue_array_set_clear_func (priv->output_queue, @@ -407,6 +412,7 @@ g_array_unref (priv->ref_frame_list_long_term); g_array_unref (priv->ref_pic_list0); g_array_unref (priv->ref_pic_list1); + g_array_unref (priv->split_nalu); gst_queue_array_free (priv->output_queue); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -540,7 +546,7 @@ GstH264DecoderPrivate *priv = self->priv; GstBuffer *in_buf = frame->input_buffer; GstH264NalUnit nalu; - GstH264ParserResult pres; + GstH264ParserResult pres = GST_H264_PARSER_OK; GstMapInfo map; GstFlowReturn decode_ret = GST_FLOW_OK; @@ -553,16 +559,27 @@ gst_buffer_map (in_buf, &map, GST_MAP_READ); if (priv->in_format == GST_H264_DECODER_FORMAT_AVC) { - pres = gst_h264_parser_identify_nalu_avc (priv->parser, - map.data, 0, map.size, priv->nal_length_size, &nalu); + guint offset = 0; + gsize consumed = 0; + guint i; + + do { + pres = gst_h264_parser_identify_and_split_nalu_avc (priv->parser, + map.data, offset, map.size, priv->nal_length_size, priv->split_nalu, + &consumed); + if (pres != GST_H264_PARSER_OK) + break; + + for (i = 0; i < priv->split_nalu->len; i++) { + GstH264NalUnit *nl = + &g_array_index (priv->split_nalu, GstH264NalUnit, i); + decode_ret = gst_h264_decoder_decode_nal (self, nl); + if (decode_ret != GST_FLOW_OK) + break; + } - while (pres == GST_H264_PARSER_OK && decode_ret == GST_FLOW_OK) { - decode_ret = gst_h264_decoder_decode_nal (self, &nalu); - - pres = gst_h264_parser_identify_nalu_avc (priv->parser, - map.data, nalu.offset + nalu.size, map.size, priv->nal_length_size, - &nalu); - } + offset += consumed; + } while (pres == GST_H264_PARSER_OK && decode_ret == GST_FLOW_OK); } else { pres = gst_h264_parser_identify_nalu (priv->parser, map.data, 0, map.size, &nalu); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/play/gstplay.c new/gst-plugins-bad-1.22.9/gst-libs/gst/play/gstplay.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/play/gstplay.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/play/gstplay.c 2024-01-24 19:21:13.000000000 +0100 @@ -4683,8 +4683,8 @@ GstStructure ** details) { PARSE_MESSAGE_FIELD (msg, GST_PLAY_MESSAGE_DATA_ERROR, G_TYPE_ERROR, error); - PARSE_MESSAGE_FIELD (msg, GST_PLAY_MESSAGE_DATA_ERROR, GST_TYPE_STRUCTURE, - details); + PARSE_MESSAGE_FIELD (msg, GST_PLAY_MESSAGE_DATA_ERROR_DETAILS, + GST_TYPE_STRUCTURE, details); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/va/gstvaallocator.c new/gst-plugins-bad-1.22.9/gst-libs/gst/va/gstvaallocator.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/va/gstvaallocator.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/va/gstvaallocator.c 2024-01-24 19:21:13.000000000 +0100 @@ -40,6 +40,8 @@ #include <sys/types.h> #include <unistd.h> +#include <stdio.h> /* sscanf */ + #include "gstvasurfacecopy.h" #include "gstvavideoformat.h" #include "vasurfaceimage.h" @@ -607,10 +609,13 @@ g_assert (GST_VIDEO_INFO_N_PLANES (&self->info) == desc.num_layers); + /* YUY2 and YUYV are the same. radeonsi returns always YUYV. + * There's no reason to fail if the different fourcc if there're dups. + * https://fourcc.org/pixel-format/yuv-yuy2/ */ if (fourcc != desc.fourcc) { - GST_ERROR ("Unsupported fourcc: %" GST_FOURCC_FORMAT, + GST_INFO ("Different fourcc: requested %" GST_FOURCC_FORMAT " - returned %" + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc), GST_FOURCC_ARGS (desc.fourcc)); - goto failed; } if (desc.num_objects == 0) { @@ -1086,7 +1091,6 @@ guint32 fourcc; guint32 rt_format; - GstVideoInfo derived_info; GstVideoInfo info; guint usage_hint; @@ -1209,6 +1213,50 @@ 0 /* align */ , 0 /* offset */ , size); } +/* + * HACK: + * + * This method should be defined as a public method of GstVaDisplay. But in + * order to backport this fix, it's kept locally. + */ +static gboolean +_gst_va_display_get_vendor_version (GstVaDisplay * display, guint * major, + guint * minor) +{ + VADisplay dpy; + guint maj, min; + const char *vendor; + + dpy = gst_va_display_get_va_dpy (display); + vendor = vaQueryVendorString (dpy); + if (vendor && sscanf (vendor, "Mesa Gallium driver %d.%d.", &maj, &min) == 2) { + *major = maj; + *minor = min; + return TRUE; + } + + return FALSE; +} + +static gboolean +_is_old_mesa (GstVaAllocator * va_allocator) +{ + guint major, minor; + + if (!GST_VA_DISPLAY_IS_IMPLEMENTATION (va_allocator->display, MESA_GALLIUM)) + return FALSE; + if (!_gst_va_display_get_vendor_version (va_allocator->display, &major, + &minor)) { + GST_WARNING ("Could not parse version from Mesa vendor string"); + return FALSE; + } + if (major > 23) + return FALSE; + if (major == 23 && minor > 2) + return FALSE; + return TRUE; +} + static inline void _update_info (GstVideoInfo * info, const VAImage * image) { @@ -1241,14 +1289,24 @@ GST_VIDEO_INFO_WIDTH (&va_allocator->info), GST_VIDEO_INFO_HEIGHT (&va_allocator->info)); + /* XXX: Derived in Mesa <23.3 can't use derived images for P010 format + * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381 + */ + if (va_allocator->img_format == GST_VIDEO_FORMAT_P010_10LE + && _is_old_mesa (va_allocator)) { + if (va_allocator->feat_use_derived != GST_VA_FEATURE_DISABLED) { + GST_INFO_OBJECT (va_allocator, "Disable image derive on old Mesa."); + va_allocator->feat_use_derived = GST_VA_FEATURE_DISABLED; + } + va_allocator->use_derived = FALSE; + } + /* Try derived first, but different formats can never derive */ if (va_allocator->feat_use_derived != GST_VA_FEATURE_DISABLED && va_allocator->surface_format == va_allocator->img_format) { if (va_get_derive_image (va_allocator->display, surface, &image)) { va_allocator->use_derived = TRUE; - va_allocator->derived_info = va_allocator->info; - _update_info (&va_allocator->derived_info, &image); - va_destroy_image (va_allocator->display, image.image_id); + goto done; } image.image_id = VA_INVALID_ID; /* reset it */ } @@ -1267,6 +1325,7 @@ return FALSE; } +done: _update_info (&va_allocator->info, &image); va_destroy_image (va_allocator->display, image.image_id); va_destroy_surfaces (va_allocator->display, &surface, 1); @@ -1313,35 +1372,20 @@ use_derived = FALSE; } else { switch (gst_va_display_get_implementation (display)) { - case GST_VA_IMPLEMENTATION_INTEL_IHD: - /* On Gen7+ Intel graphics the memory is mappable but not - * cached, so normal memcpy() access is very slow to read, but - * it's ok for writing. So let's assume that users won't prefer - * direct-mapped memory if they request read access. */ - use_derived = va_allocator->use_derived && !(flags & GST_MAP_READ); - break; case GST_VA_IMPLEMENTATION_INTEL_I965: /* YUV derived images are tiled, so writing them is also * problematic */ use_derived = va_allocator->use_derived && !((flags & GST_MAP_READ) || ((flags & GST_MAP_WRITE) - && GST_VIDEO_INFO_IS_YUV (&va_allocator->derived_info))); - break; - case GST_VA_IMPLEMENTATION_MESA_GALLIUM: - /* Reading RGB derived images, with non-standard resolutions, - * looks like tiled too. TODO(victor): fill a bug in Mesa. */ - use_derived = va_allocator->use_derived && !((flags & GST_MAP_READ) - && GST_VIDEO_INFO_IS_RGB (&va_allocator->derived_info)); + && GST_VIDEO_INFO_IS_YUV (&va_allocator->info))); break; default: use_derived = va_allocator->use_derived; break; } } - if (use_derived) - info = &va_allocator->derived_info; - else - info = &va_allocator->info; + + info = &va_allocator->info; if (!va_ensure_image (display, mem->surface, info, &mem->image, use_derived)) return NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-libs/gst/va/vasurfaceimage.c new/gst-plugins-bad-1.22.9/gst-libs/gst/va/vasurfaceimage.c --- old/gst-plugins-bad-1.22.8/gst-libs/gst/va/vasurfaceimage.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-libs/gst/va/vasurfaceimage.c 2024-01-24 19:21:13.000000000 +0100 @@ -147,6 +147,21 @@ { VADisplay dpy = gst_va_display_get_va_dpy (display); VAStatus status; + VASurfaceStatus state; + + /* When directly accessing a surface special care must be taken to insure sync + * proper synchronization with the graphics hardware. Clients should call + * vaQuerySurfaceStatus to insure that a surface is not the target of + * concurrent rendering or currently being displayed by an overlay. */ + status = vaQuerySurfaceStatus (dpy, surface, &state); + if (status != VA_STATUS_SUCCESS) { + GST_WARNING ("vaQuerySurfaceStatus: %s", vaErrorStr (status)); + return FALSE; + } + if (state != VASurfaceReady) { + GST_INFO ("Surface not ready"); + return FALSE; + } status = vaDeriveImage (dpy, surface, image); if (status != VA_STATUS_SUCCESS) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/gst-plugins-bad.doap new/gst-plugins-bad-1.22.9/gst-plugins-bad.doap --- old/gst-plugins-bad-1.22.8/gst-plugins-bad.doap 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/gst-plugins-bad.doap 2024-01-24 19:21:13.000000000 +0100 @@ -35,6 +35,16 @@ <release> <Version> + <revision>1.22.9</revision> + <branch>1.22</branch> + <name></name> + <created>2024-01-24</created> + <file-release rdf:resource="https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.22.9.tar.xz" /> + </Version> + </release> + + <release> + <Version> <revision>1.22.8</revision> <branch>1.22</branch> <name></name> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/meson.build new/gst-plugins-bad-1.22.9/meson.build --- old/gst-plugins-bad-1.22.8/meson.build 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/meson.build 2024-01-24 19:21:13.000000000 +0100 @@ -1,5 +1,5 @@ project('gst-plugins-bad', 'c', 'cpp', - version : '1.22.8', + version : '1.22.9', meson_version : '>= 0.62', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/po/gst-plugins-bad-1.0.pot new/gst-plugins-bad-1.22.9/po/gst-plugins-bad-1.0.pot --- old/gst-plugins-bad-1.22.8/po/gst-plugins-bad-1.0.pot 2023-12-18 13:16:12.781435000 +0100 +++ new/gst-plugins-bad-1.22.9/po/gst-plugins-bad-1.0.pot 2024-01-24 19:26:51.957840000 +0100 @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad-1.22.8\n" +"Project-Id-Version: gst-plugins-bad-1.22.9\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-18 12:16+0000\n" +"POT-Creation-Date: 2024-01-24 18:26+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <l...@li.org>\n" @@ -61,7 +61,7 @@ msgid "Generated file has a larger preroll time than its streams duration" msgstr "" -#: gst/camerabin2/camerabingeneral.c:167 gst/camerabin2/gstcamerabin2.c:1894 +#: gst/camerabin2/camerabingeneral.c:167 gst/camerabin2/gstcamerabin2.c:1885 #: gst/camerabin2/gstdigitalzoom.c:283 gst/camerabin2/gstviewfinderbin.c:275 #, c-format msgid "Missing element '%s' - check your GStreamer installation." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/po/gst-plugins-bad.pot new/gst-plugins-bad-1.22.9/po/gst-plugins-bad.pot --- old/gst-plugins-bad-1.22.8/po/gst-plugins-bad.pot 2023-12-18 13:16:12.781435000 +0100 +++ new/gst-plugins-bad-1.22.9/po/gst-plugins-bad.pot 2024-01-24 19:26:51.957840000 +0100 @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gst-plugins-bad-1.22.8\n" +"Project-Id-Version: gst-plugins-bad-1.22.9\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-18 12:16+0000\n" +"POT-Creation-Date: 2024-01-24 18:26+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <l...@li.org>\n" @@ -61,7 +61,7 @@ msgid "Generated file has a larger preroll time than its streams duration" msgstr "" -#: gst/camerabin2/camerabingeneral.c:167 gst/camerabin2/gstcamerabin2.c:1894 +#: gst/camerabin2/camerabingeneral.c:167 gst/camerabin2/gstcamerabin2.c:1885 #: gst/camerabin2/gstdigitalzoom.c:283 gst/camerabin2/gstviewfinderbin.c:275 #, c-format msgid "Missing element '%s' - check your GStreamer installation." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecmpeg2dec.c new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecmpeg2dec.c --- old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecmpeg2dec.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecmpeg2dec.c 2024-01-24 19:21:13.000000000 +0100 @@ -577,8 +577,8 @@ /* *INDENT-OFF* */ self->v4l2_picture = (struct v4l2_ctrl_mpeg2_picture) { - .backward_ref_ts = next_picture ? next_picture->system_frame_number * 1000 : GST_CLOCK_TIME_NONE, - .forward_ref_ts = prev_picture ? prev_picture->system_frame_number * 1000 : GST_CLOCK_TIME_NONE, + .backward_ref_ts = next_picture ? next_picture->system_frame_number * G_GUINT64_CONSTANT (1000) : GST_CLOCK_TIME_NONE, + .forward_ref_ts = prev_picture ? prev_picture->system_frame_number * G_GUINT64_CONSTANT (1000) : GST_CLOCK_TIME_NONE, .intra_dc_precision = slice->pic_ext ? slice->pic_ext->intra_dc_precision : 0, .flags = (slice->pic_ext && slice->pic_ext->top_field_first ? V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST : 0) | (slice->pic_ext && slice->pic_ext->frame_pred_frame_dct ? V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT : 0 ) | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecvp8dec.c new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecvp8dec.c --- old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecvp8dec.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecvp8dec.c 2024-01-24 19:21:13.000000000 +0100 @@ -445,15 +445,17 @@ if (decoder->last_picture) self->frame_header.last_frame_ts = - decoder->last_picture->system_frame_number * 1000; + decoder->last_picture->system_frame_number * G_GUINT64_CONSTANT (1000); if (decoder->golden_ref_picture) self->frame_header.golden_frame_ts = - decoder->golden_ref_picture->system_frame_number * 1000; + decoder->golden_ref_picture->system_frame_number * + G_GUINT64_CONSTANT (1000); if (decoder->alt_ref_picture) self->frame_header.alt_frame_ts = - decoder->alt_ref_picture->system_frame_number * 1000; + decoder->alt_ref_picture->system_frame_number * + G_GUINT64_CONSTANT (1000); GST_DEBUG_OBJECT (self, "Passing references: last %u, golden %u, alt %u", (guint32) self->frame_header.last_frame_ts / 1000, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecvp9dec.c new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecvp9dec.c --- old/gst-plugins-bad-1.22.8/sys/v4l2codecs/gstv4l2codecvp9dec.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/sys/v4l2codecs/gstv4l2codecvp9dec.c 2024-01-24 19:21:13.000000000 +0100 @@ -273,17 +273,20 @@ if (reference_frames && reference_frames->pic_list[h->ref_frame_idx[0]]) { ref_pic = reference_frames->pic_list[h->ref_frame_idx[0]]; - self->v4l2_vp9_frame.last_frame_ts = ref_pic->system_frame_number * 1000; + self->v4l2_vp9_frame.last_frame_ts = + ref_pic->system_frame_number * G_GUINT64_CONSTANT (1000); } if (reference_frames && reference_frames->pic_list[h->ref_frame_idx[1]]) { ref_pic = reference_frames->pic_list[h->ref_frame_idx[1]]; - self->v4l2_vp9_frame.golden_frame_ts = ref_pic->system_frame_number * 1000; + self->v4l2_vp9_frame.golden_frame_ts = + ref_pic->system_frame_number * G_GUINT64_CONSTANT (1000); } if (reference_frames && reference_frames->pic_list[h->ref_frame_idx[2]]) { ref_pic = reference_frames->pic_list[h->ref_frame_idx[2]]; - self->v4l2_vp9_frame.alt_frame_ts = ref_pic->system_frame_number * 1000; + self->v4l2_vp9_frame.alt_frame_ts = + ref_pic->system_frame_number * G_GUINT64_CONSTANT (1000); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gst-plugins-bad-1.22.8/tests/check/libs/h264parser.c new/gst-plugins-bad-1.22.9/tests/check/libs/h264parser.c --- old/gst-plugins-bad-1.22.8/tests/check/libs/h264parser.c 2023-12-18 13:09:37.000000000 +0100 +++ new/gst-plugins-bad-1.22.9/tests/check/libs/h264parser.c 2024-01-24 19:21:13.000000000 +0100 @@ -825,6 +825,204 @@ GST_END_TEST; +GST_START_TEST (test_h264_split_avc) +{ + GstH264NalParser *parser; + GArray *array; + GstH264NalUnit *nal; + static const guint8 aud[] = { 0x09, 0xf0 }; + static const guint8 seq_end[] = { 0x0a }; + static const guint8 sc_3bytes[] = { 0x00, 0x00, 0x01 }; + static const guint8 sc_4bytes[] = { 0x00, 0x00, 0x00, 0x01 }; + const guint8 nal_length_size = 4; + guint8 data[128]; + gsize size; + GstH264ParserResult ret; + gsize consumed; + guint off; + + parser = gst_h264_nal_parser_new (); + array = g_array_new (FALSE, FALSE, sizeof (GstH264NalUnit)); + +#define BUILD_NAL(arr) G_STMT_START { \ + memcpy (data + off, arr, sizeof (arr)); \ + off += sizeof (arr); \ +} G_STMT_END + + /* 1) Complete packetized nalu */ + size = nal_length_size + sizeof (aud); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (aud)); + BUILD_NAL (aud); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 1); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, 0); + assert_equals_int (nal->offset, nal_length_size); + assert_equals_int (nal->size, sizeof (aud)); + + /* 2-1) SC (3 bytes) + nalu */ + size = nal_length_size + sizeof (sc_3bytes) + sizeof (aud); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (sc_3bytes) + sizeof (aud)); + BUILD_NAL (sc_3bytes); + BUILD_NAL (aud); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 1); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, nal_length_size); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_3bytes)); + assert_equals_int (nal->size, sizeof (aud)); + + /* 2-2) SC (4 bytes) + nalu */ + size = nal_length_size + sizeof (sc_4bytes) + sizeof (aud); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (sc_4bytes) + sizeof (aud)); + BUILD_NAL (sc_4bytes); + BUILD_NAL (aud); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 1); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, nal_length_size); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_4bytes)); + assert_equals_int (nal->size, sizeof (aud)); + + /* 3-1) nalu + trailing SC (3 bytes) */ + size = nal_length_size + sizeof (aud) + sizeof (sc_3bytes); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (aud) + sizeof (sc_3bytes)); + BUILD_NAL (aud); + BUILD_NAL (sc_3bytes); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 1); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, 0); + assert_equals_int (nal->offset, nal_length_size); + assert_equals_int (nal->size, sizeof (aud)); + + /* 3-2) nalu + trailing SC (4 bytes) */ + size = nal_length_size + sizeof (aud) + sizeof (sc_4bytes); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (aud) + sizeof (sc_4bytes)); + BUILD_NAL (aud); + BUILD_NAL (sc_4bytes); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 1); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, 0); + assert_equals_int (nal->offset, nal_length_size); + assert_equals_int (nal->size, sizeof (aud)); + + /* 4-1) SC + nalu + SC + nalu */ + size = nal_length_size + sizeof (sc_3bytes) + sizeof (aud) + + sizeof (sc_4bytes) + sizeof (seq_end); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (sc_3bytes) + sizeof (aud) + + sizeof (sc_4bytes) + sizeof (seq_end)); + BUILD_NAL (sc_3bytes); + BUILD_NAL (aud); + BUILD_NAL (sc_4bytes); + BUILD_NAL (seq_end); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 2); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, nal_length_size); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_3bytes)); + assert_equals_int (nal->size, sizeof (aud)); + nal = &g_array_index (array, GstH264NalUnit, 1); + assert_equals_int (nal->type, GST_H264_NAL_SEQ_END); + assert_equals_int (nal->sc_offset, nal_length_size + sizeof (sc_3bytes) + + sizeof (aud)); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_3bytes) + + sizeof (aud) + sizeof (sc_4bytes)); + assert_equals_int (nal->size, sizeof (seq_end)); + + /* 4-2) SC + nalu + SC + nalu + trailing SC */ + size = nal_length_size + sizeof (sc_3bytes) + sizeof (aud) + + sizeof (sc_4bytes) + sizeof (seq_end) + sizeof (sc_3bytes); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (sc_3bytes) + sizeof (aud) + + sizeof (sc_4bytes) + sizeof (seq_end) + sizeof (sc_3bytes)); + BUILD_NAL (sc_3bytes); + BUILD_NAL (aud); + BUILD_NAL (sc_4bytes); + BUILD_NAL (seq_end); + BUILD_NAL (sc_3bytes); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 2); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, nal_length_size); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_3bytes)); + assert_equals_int (nal->size, sizeof (aud)); + nal = &g_array_index (array, GstH264NalUnit, 1); + assert_equals_int (nal->type, GST_H264_NAL_SEQ_END); + assert_equals_int (nal->sc_offset, nal_length_size + sizeof (sc_3bytes) + + sizeof (aud)); + assert_equals_int (nal->offset, nal_length_size + sizeof (sc_3bytes) + + sizeof (aud) + sizeof (sc_4bytes)); + assert_equals_int (nal->size, sizeof (seq_end)); + + /* 4-3) nalu + SC + nalu */ + size = nal_length_size + sizeof (aud) + sizeof (sc_4bytes) + sizeof (seq_end); + off = nal_length_size; + GST_WRITE_UINT32_BE (data, sizeof (aud) + sizeof (sc_4bytes) + + sizeof (seq_end)); + BUILD_NAL (aud); + BUILD_NAL (sc_4bytes); + BUILD_NAL (seq_end); + ret = gst_h264_parser_identify_and_split_nalu_avc (parser, data, + 0, size, nal_length_size, array, &consumed); + assert_equals_int (ret, GST_H264_PARSER_OK); + assert_equals_int (array->len, 2); + assert_equals_int (consumed, size); + nal = &g_array_index (array, GstH264NalUnit, 0); + assert_equals_int (nal->type, GST_H264_NAL_AU_DELIMITER); + assert_equals_int (nal->sc_offset, 0); + assert_equals_int (nal->offset, nal_length_size); + assert_equals_int (nal->size, sizeof (aud)); + nal = &g_array_index (array, GstH264NalUnit, 1); + assert_equals_int (nal->type, GST_H264_NAL_SEQ_END); + assert_equals_int (nal->sc_offset, nal_length_size + sizeof (aud)); + assert_equals_int (nal->offset, + nal_length_size + sizeof (aud) + sizeof (sc_4bytes)); + assert_equals_int (nal->size, sizeof (seq_end)); + +#undef BUILD_NAL + + gst_h264_nal_parser_free (parser); + g_array_unref (array); +} + +GST_END_TEST; + static Suite * h264parser_suite (void) { @@ -840,6 +1038,7 @@ tcase_add_test (tc_chain, test_h264_parse_invalid_sei); tcase_add_test (tc_chain, test_h264_create_sei); tcase_add_test (tc_chain, test_h264_decoder_config_record); + tcase_add_test (tc_chain, test_h264_split_avc); return s; } ++++++ reduce-required-meson.patch ++++++ --- /var/tmp/diff_new_pack.Cp3g4W/_old 2024-02-02 15:45:00.939792200 +0100 +++ /var/tmp/diff_new_pack.Cp3g4W/_new 2024-02-02 15:45:00.943792344 +0100 @@ -1,10 +1,10 @@ -Index: gst-plugins-bad-1.22.8/meson.build +Index: gst-plugins-bad-1.22.9/meson.build =================================================================== ---- gst-plugins-bad-1.22.8.orig/meson.build -+++ gst-plugins-bad-1.22.8/meson.build +--- gst-plugins-bad-1.22.9.orig/meson.build ++++ gst-plugins-bad-1.22.9/meson.build @@ -1,6 +1,6 @@ project('gst-plugins-bad', 'c', 'cpp', - version : '1.22.8', + version : '1.22.9', - meson_version : '>= 0.62', + meson_version : '>= 0.61', default_options : [ 'warning_level=1',