gstreamer/subprojects/gst-libav/ext/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
..
gstav.c Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstav.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavauddec.c avauddec: address regression with WMA files .. 2022-10-06 01:03:10 +00:00
gstavauddec.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavaudenc.c avaudenc: Add support for AV_PKT_DATA_SKIP_SAMPLES side data 2022-03-14 10:32:15 +02:00
gstavaudenc.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavcfg.c libav: Fix for APNG encoder property registration 2022-07-08 13:56:35 +00:00
gstavcfg.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavcodecmap.c gst-libav: fix build with ffmpeg-5.0.0 2022-01-17 18:11:32 +08:00
gstavcodecmap.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavdeinterlace.c Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavdemux.c gst-libav: Fix synchronization issues and errors created by the forwarding of 2022-10-21 23:17:58 +00:00
gstavmux.c Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavprotocol.c Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavprotocol.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavutils.c gst-libav: fix build with ffmpeg-5.0.0 2022-01-17 18:11:32 +08:00
gstavutils.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavviddec.c avviddec, video.c, h265parse: Workaround for broken field-based interlaced encoders 2022-06-16 10:03:02 +00:00
gstavviddec.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
gstavvidenc.c gst-libav: fix build with ffmpeg-5.0.0 2022-01-17 18:11:32 +08:00
gstavvidenc.h Move files from gst-libav into the "subprojects/gst-libav/" subdir 2021-09-24 16:15:08 -03:00
meson.build meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00