openh264: Fail gracefully if openh264 encoder/decoder creation fails
authorKalev Lember <klember@redhat.com>
Tue, 31 Oct 2023 16:59:32 +0000 (17:59 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 1 Nov 2023 17:10:01 +0000 (17:10 +0000)
commitf44f36482c35750056e3342766580dfed141841d
treef66eca62b5c805b07457d8b947c637df829da8fb
parentcb6955944fde992749bfe182c67f59bfc4eda5fc
openh264: Fail gracefully if openh264 encoder/decoder creation fails

This can happen with the dummy "noopenh264" library that the freedesktop
flatpak runtime ships, and Fedora is planning on shipping as well. In
both cases the dummy implementation gets replaced with the actual
openh264 library that's downloaded directly from Cisco, but just to be
on safe side, this patch makes it careful to check the return values to
avoid crashing if the underlying library hasn't been swapped out yet.

The patch is taken from freedesktop-sdk and was originally written by
Valentin David <valentin.david@codethink.co.uk>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5586>
subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp
subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp