mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
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>
This commit is contained in:
parent
7bc5ed34fd
commit
0812c753c6
1 changed files with 7 additions and 4 deletions
|
@ -1104,10 +1104,12 @@ static const struct
|
||||||
"artist", GST_TAG_ARTIST}, {
|
"artist", GST_TAG_ARTIST}, {
|
||||||
"comment", GST_TAG_COMMENT}, {
|
"comment", GST_TAG_COMMENT}, {
|
||||||
"composer", GST_TAG_COMPOSER}, {
|
"composer", GST_TAG_COMPOSER}, {
|
||||||
"copyright", GST_TAG_COPYRIGHT}, {
|
"copyright", GST_TAG_COPYRIGHT},
|
||||||
/* Need to convert ISO 8601 to GstDateTime: */
|
/* Need to convert ISO 8601 to GstDateTime: */
|
||||||
"creation_time", GST_TAG_DATE_TIME}, {
|
{
|
||||||
/* Need to convert ISO 8601 to GDateTime: */
|
"creation_time", GST_TAG_DATE_TIME},
|
||||||
|
/* Need to convert ISO 8601 to GDateTime: */
|
||||||
|
{
|
||||||
"date", GST_TAG_DATE_TIME}, {
|
"date", GST_TAG_DATE_TIME}, {
|
||||||
"disc", GST_TAG_ALBUM_VOLUME_NUMBER}, {
|
"disc", GST_TAG_ALBUM_VOLUME_NUMBER}, {
|
||||||
"encoder", GST_TAG_ENCODER}, {
|
"encoder", GST_TAG_ENCODER}, {
|
||||||
|
@ -1738,6 +1740,7 @@ gst_ffmpegdemux_sink_event (GstPad * sinkpad, GstObject * parent,
|
||||||
goto done;
|
goto done;
|
||||||
case GST_EVENT_STREAM_START:
|
case GST_EVENT_STREAM_START:
|
||||||
case GST_EVENT_CAPS:
|
case GST_EVENT_CAPS:
|
||||||
|
case GST_EVENT_SEGMENT:
|
||||||
GST_LOG_OBJECT (demux, "dropping %s event", GST_EVENT_TYPE_NAME (event));
|
GST_LOG_OBJECT (demux, "dropping %s event", GST_EVENT_TYPE_NAME (event));
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in a new issue