videoaggregator: keep old buffer when processing a MISSING_DATA gap

GAP events flagged with MISSING_DATA are transformed into GAP buffers
flagged with CORRUPTED.

In these cases, it is preferable to simply keep rendering the previous
buffer (if there was one) instead of flashing the pad in and out of
view.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/708>
This commit is contained in:
Mathieu Duponchelle 2020-11-26 18:18:52 +01:00 committed by GStreamer Marge Bot
parent 7988acad36
commit 4ef3b1ad8f

View file

@ -1888,7 +1888,16 @@ gst_video_aggregator_fill_queues (GstVideoAggregator * vagg,
GST_DEBUG_OBJECT (pad, GST_DEBUG_OBJECT (pad,
"Taking new buffer with start time %" GST_TIME_FORMAT, "Taking new buffer with start time %" GST_TIME_FORMAT,
GST_TIME_ARGS (start_running_time)); GST_TIME_ARGS (start_running_time));
gst_buffer_replace (&pad->priv->buffer, buf);
if ((gst_buffer_get_size (buf) == 0 &&
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP) &&
gst_buffer_get_custom_meta (buf,
"GstAggregatorMissingDataMeta"))) {
GST_DEBUG_OBJECT (pad, "Consuming gap but keeping old buffer around");
} else {
gst_buffer_replace (&pad->priv->buffer, buf);
}
if (pad->priv->pending_vinfo.finfo) { if (pad->priv->pending_vinfo.finfo) {
gst_caps_replace (&pad->priv->caps, pad->priv->pending_caps); gst_caps_replace (&pad->priv->caps, pad->priv->pending_caps);
gst_caps_replace (&pad->priv->pending_caps, NULL); gst_caps_replace (&pad->priv->pending_caps, NULL);
@ -1908,7 +1917,15 @@ gst_video_aggregator_fill_queues (GstVideoAggregator * vagg,
gst_buffer_unref (buf); gst_buffer_unref (buf);
eos = FALSE; eos = FALSE;
} else { } else {
gst_buffer_replace (&pad->priv->buffer, buf); if ((gst_buffer_get_size (buf) == 0 &&
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP) &&
gst_buffer_get_custom_meta (buf,
"GstAggregatorMissingDataMeta"))) {
GST_DEBUG_OBJECT (pad, "Consuming gap but keeping old buffer around");
} else {
gst_buffer_replace (&pad->priv->buffer, buf);
}
if (pad->priv->pending_vinfo.finfo) { if (pad->priv->pending_vinfo.finfo) {
gst_caps_replace (&pad->priv->caps, pad->priv->pending_caps); gst_caps_replace (&pad->priv->caps, pad->priv->pending_caps);
gst_caps_replace (&pad->priv->pending_caps, NULL); gst_caps_replace (&pad->priv->pending_caps, NULL);