gstreamer/subprojects/gst-libav
Devin Anderson 0812c753c6 gst-libav: Fix synchronization issues and errors created by the forwarding of
segment events by demuxer.

In order to play nicely with `ffmpeg`, demuxers in `gst-libav` have to make
buffers available to `ffmpeg` while taking the blocking I/O model in `ffmpeg`
into account, which results in buffers not being sent downstream until `ffmpeg`
has processed them in its separate thread.

In constrast, many `gstreamer` events are simply forwarded downstream.
Currently `GST_EVENT_SEGMENT` events are forwarded downstream without any
processing, which can potentially result in:
 * `GST_EVENT_SEGMENT` events being out of sync with buffers
 * `GST_EVENT_SEGMENT` events going out that are incorrect because they apply
   to data seen by the demuxer, but not necessarily seen by downstream elements

I came across this bug when I was attempting to enable G723.1 demuxing/decoding
using the G723.1 demuxer and decoder provided by `ffmpeg`.  I wrote tests to
verify support for the functionality, and found that, in push mode,
`GST_EVENT_SEGMENT` events pushed to the demuxer by the upstream `filesrc`
element would be forwarded to the decoder without modification, resulting in
an internal data streaming error.  With this patch, tests work in both push and
pull mode.

This patch solves the problem by disabling the forwarding of
`GST_EVENT_SEGMENT` events downstream (an initial `GST_EVENT_SEGMENT` event is
still pushed downstream by the demuxer).  It's possible there's a better way to
do this, but, having looked at how a few different `gstreamer` demuxers deal
with `GST_EVENT_SEGMENT` events, it seems like the processing is somewhat
specific to the demuxer implementation, whereas `gst-libav` has one general way
of handling the situation for any `ffmpeg` demuxer.  Perhaps there's a better
way to solve this using the `ffmpeg` API to take advantage of specific demuxer
details.  IDK.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3218>
2022-10-21 23:17:58 +00:00
..
docs Build documentation for rust plugins 2022-09-15 20:11:47 +00:00
ext/libav gst-libav: Fix synchronization issues and errors created by the forwarding of 2022-10-21 23:17:58 +00:00
scripts Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
tests meson: update for meson.build_root() and .build_source() deprecation 2021-10-20 11:20:44 +00:00
.gitignore Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
AUTHORS Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
ChangeLog Release 1.21.1 2022-10-04 01:18:20 +01:00
COPYING Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gst-libav.doap Release 1.21.1 2022-10-04 01:18:20 +01:00
meson.build Back to development 2022-10-04 03:57:31 +01:00
meson_options.txt Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
NEWS Release 1.21.1 2022-10-04 01:18:20 +01:00
README.md Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
RELEASE Release 1.21.1 2022-10-04 01:18:20 +01:00

gst-libav

This module contains a GStreamer plugin for using the encoders, decoders, muxers, and demuxers provided by FFmpeg. It is called gst-libav for historical reasons.

Plugin Dependencies and Licenses

GStreamer is developed under the terms of the LGPL-2.1 (see COPYING file for details), and that includes the code in this repository.

However, this repository depends on FFmpeg, which can be built in the following modes using various ./configure switches: LGPL-2.1, LGPL-3, GPL, or non-free.

This can mean, for example, that if you are distributing an application which has a non-GPL compatible license (like a closed-source application) with GStreamer, you have to make sure not to build FFmpeg with GPL code enabled.

Overall, when using plugins that link to GPL libraries, GStreamer is for all practical reasons under the GPL itself.

The above recommendations are not legal advice, and you are responsible for ensuring that you meet your licensing obligations.