mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 10:42:22 +00:00
streamsynchronizer: send preroll buffer when delaying preroll eos
That is, if eos is received which will not be forwarded, and the stream has not yet seen any data, then send a buffer to preroll downstream (which might otherwise be accomplished by the eos event).
This commit is contained in:
parent
2379e96bbc
commit
c1a705acbc
1 changed files with 18 additions and 0 deletions
|
@ -67,6 +67,7 @@ typedef struct
|
||||||
gboolean new_stream;
|
gboolean new_stream;
|
||||||
gboolean drop_discont;
|
gboolean drop_discont;
|
||||||
gboolean is_eos;
|
gboolean is_eos;
|
||||||
|
gboolean seen_data;
|
||||||
|
|
||||||
gint64 running_time_diff;
|
gint64 running_time_diff;
|
||||||
} GstStream;
|
} GstStream;
|
||||||
|
@ -446,6 +447,7 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
|
||||||
stream->wait = FALSE;
|
stream->wait = FALSE;
|
||||||
stream->new_stream = FALSE;
|
stream->new_stream = FALSE;
|
||||||
stream->drop_discont = FALSE;
|
stream->drop_discont = FALSE;
|
||||||
|
stream->seen_data = FALSE;
|
||||||
}
|
}
|
||||||
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
|
GST_STREAM_SYNCHRONIZER_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
|
@ -454,7 +456,9 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GstStream *stream;
|
GstStream *stream;
|
||||||
GList *l;
|
GList *l;
|
||||||
gboolean all_eos = TRUE;
|
gboolean all_eos = TRUE;
|
||||||
|
gboolean seen_data;
|
||||||
GSList *pads = NULL;
|
GSList *pads = NULL;
|
||||||
|
GstPad *srcpad;
|
||||||
|
|
||||||
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
||||||
stream = gst_pad_get_element_private (pad);
|
stream = gst_pad_get_element_private (pad);
|
||||||
|
@ -463,6 +467,9 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
|
||||||
stream->is_eos = TRUE;
|
stream->is_eos = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seen_data = stream->seen_data;
|
||||||
|
srcpad = gst_object_ref (stream->srcpad);
|
||||||
|
|
||||||
for (l = self->streams; l; l = l->next) {
|
for (l = self->streams; l; l = l->next) {
|
||||||
GstStream *ostream = l->data;
|
GstStream *ostream = l->data;
|
||||||
|
|
||||||
|
@ -496,7 +503,17 @@ gst_stream_synchronizer_sink_event (GstPad * pad, GstEvent * event)
|
||||||
epad = g_slist_next (epad);
|
epad = g_slist_next (epad);
|
||||||
}
|
}
|
||||||
g_slist_free (pads);
|
g_slist_free (pads);
|
||||||
|
} else {
|
||||||
|
/* if EOS, but no data has passed, then send something to replace EOS
|
||||||
|
* for preroll purposes */
|
||||||
|
if (!seen_data) {
|
||||||
|
GstBuffer *buf = gst_buffer_new ();
|
||||||
|
|
||||||
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_PREROLL);
|
||||||
|
gst_pad_push (srcpad, buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gst_object_unref (srcpad);
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -563,6 +580,7 @@ gst_stream_synchronizer_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
GST_STREAM_SYNCHRONIZER_LOCK (self);
|
||||||
stream = gst_pad_get_element_private (pad);
|
stream = gst_pad_get_element_private (pad);
|
||||||
|
|
||||||
|
stream->seen_data = TRUE;
|
||||||
if (stream && stream->drop_discont) {
|
if (stream && stream->drop_discont) {
|
||||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
buffer = gst_buffer_make_metadata_writable (buffer);
|
||||||
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DISCONT);
|
||||||
|
|
Loading…
Reference in a new issue