adaptivedemux: Don't calculate bitrate for header/index fragments
authorEdward Hervey <edward@centricular.com>
Tue, 10 Nov 2020 13:48:28 +0000 (14:48 +0100)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 11 Nov 2020 19:46:16 +0000 (19:46 +0000)
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
66f5e874352016e29f555e3ce693b23474e476db

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1786>

gst-libs/gst/adaptivedemux/gstadaptivedemux.c

index 8149a2a..e74a009 100644 (file)
@@ -2773,7 +2773,8 @@ gst_adaptive_demux_eos_handling (GstAdaptiveDemuxStream * stream)
     /* Last chance to figure out a fallback nominal bitrate if neither baseclass
        nor the HTTP Content-Length implementation worked. */
     if (stream->fragment.bitrate == 0 && stream->fragment.duration != 0 &&
-        stream->fragment_bytes_downloaded != 0) {
+        stream->fragment_bytes_downloaded != 0 && !stream->downloading_index &&
+        !stream->downloading_header) {
       guint bitrate = MIN (G_MAXUINT,
           gst_util_uint64_scale (stream->fragment_bytes_downloaded,
               8 * GST_SECOND, stream->fragment.duration));