adaptivedemux: Don't calculate bitrate for header/index fragments

They are generally substantially smaller than regular fragments, and therefore
we end up pushing totally wrong bitrates downstream.

Fixes erratic buffering issues with DASH introduced by
66f5e87435

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1021>
This commit is contained in:
Edward Hervey 2020-11-10 14:48:28 +01:00 committed by GStreamer Merge Bot
parent dd425fe0fd
commit 7b2368b6df

View file

@ -1911,17 +1911,23 @@ gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
case GST_EVENT_QOS:{ case GST_EVENT_QOS:{
GstClockTimeDiff diff; GstClockTimeDiff diff;
GstClockTime timestamp; GstClockTime timestamp;
GstClockTime earliest_time;
gst_event_parse_qos (event, NULL, NULL, &diff, &timestamp); gst_event_parse_qos (event, NULL, NULL, &diff, &timestamp);
/* Only take into account lateness if late */ /* Only take into account lateness if late */
GST_OBJECT_LOCK (demux);
if (diff > 0) if (diff > 0)
demux->priv->qos_earliest_time = timestamp + 2 * diff; earliest_time = timestamp + 2 * diff;
else else
demux->priv->qos_earliest_time = timestamp; earliest_time = timestamp;
GST_OBJECT_LOCK (demux);
if (!GST_CLOCK_TIME_IS_VALID (demux->priv->qos_earliest_time) ||
earliest_time > demux->priv->qos_earliest_time) {
demux->priv->qos_earliest_time = earliest_time;
GST_DEBUG_OBJECT (demux, "qos_earliest_time %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->priv->qos_earliest_time));
}
GST_OBJECT_UNLOCK (demux); GST_OBJECT_UNLOCK (demux);
GST_DEBUG_OBJECT (demux, "qos_earliest_time %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->priv->qos_earliest_time));
break; break;
} }
default: default:
@ -4661,7 +4667,7 @@ gst_adaptive_demux_clock_callback (GstClock * clock,
* *
* Returns: The QOS earliest time * Returns: The QOS earliest time
* *
* Since: 1.18 * Since: 1.20
*/ */
GstClockTime GstClockTime
gst_adaptive_demux_get_qos_earliest_time (GstAdaptiveDemux * demux) gst_adaptive_demux_get_qos_earliest_time (GstAdaptiveDemux * demux)