mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
adaptivedemux: Add another nominal bitrate fallback calculation
Some HTTP servers don't provide fragment sizes (with the Content-Length HTTP header). In order to still figure out a nominal bitrate (for usage by queue2), calculate on when we're done downloading a fragment. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1544>
This commit is contained in:
parent
298eedad8b
commit
66f5e87435
1 changed files with 15 additions and 0 deletions
|
@ -2769,6 +2769,21 @@ gst_adaptive_demux_eos_handling (GstAdaptiveDemuxStream * stream)
|
|||
|| !klass->need_another_chunk (stream)
|
||||
|| stream->fragment.chunk_size == 0) {
|
||||
stream->fragment.finished = TRUE;
|
||||
|
||||
/* 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) {
|
||||
guint bitrate = MIN (G_MAXUINT,
|
||||
gst_util_uint64_scale (stream->fragment_bytes_downloaded,
|
||||
8 * GST_SECOND, stream->fragment.duration));
|
||||
GST_LOG_OBJECT (stream->pad,
|
||||
"Fragment has size %" G_GUINT64_FORMAT " duration %" GST_TIME_FORMAT
|
||||
" = bitrate %u", stream->fragment_bytes_downloaded,
|
||||
GST_TIME_ARGS (stream->fragment.duration), bitrate);
|
||||
stream->fragment.bitrate = bitrate;
|
||||
stream->bitrate_changed = TRUE;
|
||||
}
|
||||
ret = klass->finish_fragment (stream->demux, stream);
|
||||
}
|
||||
gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
|
||||
|
|
Loading…
Reference in a new issue