hlsdemux2: Implement the stream submit_request() vfunc

Implement the submit_request() vfunc for streams and fulfil requests from the
preload hint data if possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
Jan Schmidt 2022-10-14 06:28:47 +11:00 committed by GStreamer Marge Bot
parent a7e5236a39
commit 44107d0c4b

View file

@ -136,6 +136,9 @@ static GstFlowReturn
gst_hls_demux_stream_advance_fragment (GstAdaptiveDemux2Stream * stream);
static GstFlowReturn
gst_hls_demux_stream_update_fragment_info (GstAdaptiveDemux2Stream * stream);
static GstFlowReturn
gst_hls_demux_stream_submit_request (GstAdaptiveDemux2Stream * stream,
DownloadRequest * download_req);
static gboolean gst_hls_demux_stream_can_start (GstAdaptiveDemux2Stream *
stream);
static void gst_hls_demux_stream_create_tracks (GstAdaptiveDemux2Stream *
@ -166,6 +169,8 @@ gst_hls_demux_stream_class_init (GstHLSDemuxStreamClass * klass)
adaptivedemux2stream_class->update_fragment_info =
gst_hls_demux_stream_update_fragment_info;
adaptivedemux2stream_class->submit_request =
gst_hls_demux_stream_submit_request;
adaptivedemux2stream_class->has_next_fragment =
gst_hls_demux_stream_has_next_fragment;
adaptivedemux2stream_class->stream_seek = gst_hls_demux_stream_seek;
@ -2358,6 +2363,24 @@ gst_hls_demux_stream_update_preloads (GstHLSDemuxStream * hlsdemux_stream)
}
}
static GstFlowReturn
gst_hls_demux_stream_submit_request (GstAdaptiveDemux2Stream * stream,
DownloadRequest * download_req)
{
GstHLSDemuxStream *hlsdemux_stream = GST_HLS_DEMUX_STREAM_CAST (stream);
/* See if the request can be satisfied from a preload */
if (hlsdemux_stream->preloader != NULL) {
if (gst_hls_demux_preloader_provide_request (hlsdemux_stream->preloader,
download_req))
return GST_FLOW_OK;
}
return
GST_ADAPTIVE_DEMUX2_STREAM_CLASS (stream_parent_class)->submit_request
(stream, download_req);
}
static GstFlowReturn
gst_hls_demux_stream_update_media_playlist (GstHLSDemux * demux,
GstHLSDemuxStream * stream, gchar ** uri, GError ** err)