Skip to content

patches for (1) broken videoflip method and (2) broken ximagesink in GStreamer 1.22.0

fduncanh edited this page Jun 1, 2024 · 8 revisions
  • A regression that broke user setting of "videoflip" was introduced in GStreamer-plugins-good v. 1.22.0
  • new features (touchscreen support) in "ximagesink" also introduce a bug that produces a segmentation fault at least on Raspberry Pi

1. videoflip support

  • note: the latest version UxPlay-1.68.3 has a modernized videoflip support that does not need gstreamer-1.22.0 to be patched.

The problem appeared in GStreamer-1.22.0, and was first fixed in 1.22.3. Evidently this did not completely solve all related issues, as versions of an additional fix were merged 3 times, becoming stable in 1.22.6

The patch here includes all these fixes, and can be applied to gstreamer-plugins-good 1.22.0, 1.22.1, and 1.22.2

  • The problem also affects Ubuntu 23.04 which provides GStreamer 1.22.1 (but not Ubuntu 23.10, which supplies the fully-fixed GStreamer-1.22.6)

References:

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/b17fbb231cde6fd72e356daa43122084693fef7d

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/2dc0e1ac877c7122ff57d557395f768dbc7ec55a

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/4c77bc21617d3717bcd677d1fd3dce71713edb2b

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/bbca6cc8c8125f53b74f7b9a5b7a559595f9cf89

The patch is:

https://github.com/FDH2/UxPlay/files/14551547/gst_videoflip_1_22_0_diff.txt

2. ximagesink support

The patch is:

https://github.com/FDH2/UxPlay/files/15464514/gst_ximagesink_1_22_0.diff.txt

The changes in GStreamer-1.22 to ximagesink videosink (but not the better xvimagesink videosink with XV support) needs a one-line fix to correct a missing initialization which causes a segmentation fault on some systems, when ximagesink starts rendering video. No patch is supplied, but you can fix it by editing line 587 of gst-plugins-base/sysximage/ximagesink.c: ( change "unsigned char mask[2];" to "unsigned char mask[2] = {0};". The bug is now fixed in GStreamer 1.22.12 and later, and 1.24.3 and later.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6631/diffs

3. Applying the patch (Raspberry Pi OS Bookworm: adapt for Ubuntu, etc if needed)

  1. Edit /etc/apt/sources.list to uncomment the deb-src items (use an editor like nano with sudo: sudo nano /etc/apt/sources.list) and save the changes.

  2. sudo apt update

  3. sudo apt install devscripts

  4. install the build dependencies for the packages to be patched: sudo apt build-dep gstreamer1.0-plugins-<name>, where plugins-<name> is "plugins-good" for the videoflip fix, and "plugins-base" for the ximagesink fix.

  5. Now create a directory in your user space where you will rebuild the package, and cd to it. For the videoflip or ximagesink fixes, get the patch:

wget https://github.com/FDH2/UxPlay/files/14551547/gst_videoflip_1_22_0_diff.txt

or

wget https://github.com/FDH2/UxPlay/files/15464514/gst_ximagesink_1_22_0.diff.txt

6 Then, without using sudo, apt source gstreamer1.0-plugins-<name>, and then cd gst-plugins*-1.22.0, followed by debuild. Wait while debuild rebuilds the package; ignore any error messages. When it stops, you can optionally verify that it rebuilt correctly with: cd obj* ; ninja ; cd .. . This should give the response "ninja: no work to do".

  1. Now (a) apply the patch (videoflip) or (b) edit the source (ximagesink):
patch -p1 < ../gst_<name>_1_22_0_diff.txt     (<name> = videoflip or ximagesink)
  1. Now rebuild (just the changed file) with cd obj*; ninja

  2. This will build the fixed library. Then for the videoflip fix cd gst/videofilter and for the ximagesink fix, cd sys/ximage, followed by strip *.so.

  3. now install the fixed library with sudo cp libgst<libname>.so /usr/<libdir>/gstreamer-1.0/ where <libname> is either "videofilter" or "ximagesink" and <libdir> is either "aarch64-linux-gnu" (64 bit systems) or "arm-linux-gnueabihf" (32 bit systems).

  • if gstreamer1.0-plugins-good or plugins-base is updated without these fixes, you will need to repeat #10