mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
adaptivedemux: allow downloads of headers only
In order to get some subsegment information, subclasses might want to download only the headers to have enough data (the index) to decide where to start downloading from the subsegment.
This commit is contained in:
parent
f7e9a58c58
commit
5c3a87c117
1 changed files with 31 additions and 29 deletions
|
@ -1705,6 +1705,10 @@ gst_adaptive_demux_stream_download_fragment (GstAdaptiveDemuxStream * stream)
|
||||||
stream->first_fragment_buffer = TRUE;
|
stream->first_fragment_buffer = TRUE;
|
||||||
g_mutex_unlock (&stream->fragment_download_lock);
|
g_mutex_unlock (&stream->fragment_download_lock);
|
||||||
|
|
||||||
|
if (stream->fragment.uri == NULL && stream->fragment.header_uri == NULL &&
|
||||||
|
stream->fragment.index_uri == NULL)
|
||||||
|
goto no_url_error;
|
||||||
|
|
||||||
if (stream->need_header) {
|
if (stream->need_header) {
|
||||||
ret = gst_adaptive_demux_stream_download_header_fragment (stream);
|
ret = gst_adaptive_demux_stream_download_header_fragment (stream);
|
||||||
stream->need_header = FALSE;
|
stream->need_header = FALSE;
|
||||||
|
@ -1715,38 +1719,36 @@ gst_adaptive_demux_stream_download_fragment (GstAdaptiveDemuxStream * stream)
|
||||||
|
|
||||||
url = stream->fragment.uri;
|
url = stream->fragment.uri;
|
||||||
GST_DEBUG_OBJECT (stream->pad, "Got url '%s' for stream %p", url, stream);
|
GST_DEBUG_OBJECT (stream->pad, "Got url '%s' for stream %p", url, stream);
|
||||||
if (!url) {
|
if (url) {
|
||||||
goto no_url_error;
|
ret = gst_adaptive_demux_stream_download_uri (demux, stream, url, 0, -1);
|
||||||
}
|
GST_DEBUG_OBJECT (stream->pad, "Fragment download result: %d %s",
|
||||||
|
stream->last_ret, gst_flow_get_name (stream->last_ret));
|
||||||
ret = gst_adaptive_demux_stream_download_uri (demux, stream, url, 0, -1);
|
if (ret == GST_FLOW_OK) {
|
||||||
|
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
||||||
GST_DEBUG_OBJECT (stream->pad, "Fragment download result: %d %s",
|
gst_message_new_element (GST_OBJECT_CAST (demux),
|
||||||
stream->last_ret, gst_flow_get_name (stream->last_ret));
|
gst_structure_new (STATISTICS_MESSAGE_NAME,
|
||||||
|
"manifest-uri", G_TYPE_STRING,
|
||||||
if (ret == GST_FLOW_OK) {
|
demux->manifest_uri, "uri", G_TYPE_STRING,
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
url, "fragment-start-time",
|
||||||
gst_message_new_element (GST_OBJECT_CAST (demux),
|
GST_TYPE_CLOCK_TIME, stream->download_start_time,
|
||||||
gst_structure_new (STATISTICS_MESSAGE_NAME,
|
"fragment-stop-time", GST_TYPE_CLOCK_TIME,
|
||||||
"manifest-uri", G_TYPE_STRING,
|
gst_util_get_timestamp (), "fragment-size", G_TYPE_UINT64,
|
||||||
demux->manifest_uri, "uri", G_TYPE_STRING,
|
stream->download_total_bytes, "fragment-download-time",
|
||||||
url, "fragment-start-time",
|
GST_TYPE_CLOCK_TIME,
|
||||||
GST_TYPE_CLOCK_TIME, stream->download_start_time,
|
stream->download_total_time * GST_USECOND, NULL)));
|
||||||
"fragment-stop-time", GST_TYPE_CLOCK_TIME,
|
} else {
|
||||||
gst_util_get_timestamp (), "fragment-size", G_TYPE_UINT64,
|
GST_INFO_OBJECT (demux, "No fragment downloaded");
|
||||||
stream->download_total_bytes, "fragment-download-time",
|
/* TODO check if we are truly stoping */
|
||||||
GST_TYPE_CLOCK_TIME, stream->download_total_time * GST_USECOND,
|
if (ret != GST_FLOW_ERROR && gst_adaptive_demux_is_live (demux)) {
|
||||||
NULL)));
|
/* looks like there is no way of knowing when a live stream has ended
|
||||||
} else {
|
* Have to assume we are falling behind and cause a manifest reload */
|
||||||
GST_INFO_OBJECT (demux, "No fragment downloaded");
|
return GST_FLOW_EOS;
|
||||||
/* TODO check if we are truly stoping */
|
}
|
||||||
if (ret != GST_FLOW_ERROR && gst_adaptive_demux_is_live (demux)) {
|
|
||||||
/* looks like there is no way of knowing when a live stream has ended
|
|
||||||
* Have to assume we are falling behind and cause a manifest reload */
|
|
||||||
return GST_FLOW_EOS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
no_url_error:
|
no_url_error:
|
||||||
|
|
Loading…
Reference in a new issue