mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
adaptivedemux: Handle invalid HTTP duration
The default BYTE DURATION basesrc query handler will return `-1` and TRUE. In order to properly handle cases where upstream http servers didn't return a valid Content-Length we also need to check whether it was valid when calculating bitrates. Avoids returning completely bogus bitrates with gogol's video streaming services Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1544>
This commit is contained in:
parent
d1d2acead1
commit
298eedad8b
1 changed files with 2 additions and 2 deletions
|
@ -2662,11 +2662,11 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
if (stream->fragment.bitrate == 0 &&
|
if (stream->fragment.bitrate == 0 &&
|
||||||
stream->fragment.duration != 0 &&
|
stream->fragment.duration != 0 &&
|
||||||
gst_element_query_duration (stream->uri_handler, GST_FORMAT_BYTES,
|
gst_element_query_duration (stream->uri_handler, GST_FORMAT_BYTES,
|
||||||
&chunk_size)) {
|
&chunk_size) && chunk_size != -1) {
|
||||||
guint bitrate = MIN (G_MAXUINT, gst_util_uint64_scale (chunk_size,
|
guint bitrate = MIN (G_MAXUINT, gst_util_uint64_scale (chunk_size,
|
||||||
8 * GST_SECOND, stream->fragment.duration));
|
8 * GST_SECOND, stream->fragment.duration));
|
||||||
GST_LOG_OBJECT (demux,
|
GST_LOG_OBJECT (demux,
|
||||||
"Fragment has size %" G_GUINT64_FORMAT " duration %" GST_TIME_FORMAT
|
"Fragment has size %" G_GINT64_FORMAT " duration %" GST_TIME_FORMAT
|
||||||
" = bitrate %u", chunk_size,
|
" = bitrate %u", chunk_size,
|
||||||
GST_TIME_ARGS (stream->fragment.duration), bitrate);
|
GST_TIME_ARGS (stream->fragment.duration), bitrate);
|
||||||
stream->fragment.bitrate = bitrate;
|
stream->fragment.bitrate = bitrate;
|
||||||
|
|
Loading…
Reference in a new issue