mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 00:32:43 +00:00
dashdemux: avoid busy-looping when waiting for new fragment
When all fragments have already been downloaded on a live stream dashdemux would busy loop as the default implementation of has_next_fragment would return TRUE. Implement it to correctly signal if adaptivedemux should wait for the manifest update before trying to get new fragments.
This commit is contained in:
parent
23ad922b64
commit
f4789d0430
3 changed files with 30 additions and 0 deletions
|
@ -205,6 +205,8 @@ static GstFlowReturn
|
||||||
gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream);
|
gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream);
|
||||||
static GstFlowReturn gst_dash_demux_stream_seek (GstAdaptiveDemuxStream *
|
static GstFlowReturn gst_dash_demux_stream_seek (GstAdaptiveDemuxStream *
|
||||||
stream, GstClockTime ts);
|
stream, GstClockTime ts);
|
||||||
|
static gboolean
|
||||||
|
gst_dash_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream);
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream);
|
gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream);
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -361,6 +363,8 @@ gst_dash_demux_class_init (GstDashDemuxClass * klass)
|
||||||
|
|
||||||
gstadaptivedemux_class->has_next_period = gst_dash_demux_has_next_period;
|
gstadaptivedemux_class->has_next_period = gst_dash_demux_has_next_period;
|
||||||
gstadaptivedemux_class->advance_period = gst_dash_demux_advance_period;
|
gstadaptivedemux_class->advance_period = gst_dash_demux_advance_period;
|
||||||
|
gstadaptivedemux_class->stream_has_next_fragment =
|
||||||
|
gst_dash_demux_stream_has_next_fragment;
|
||||||
gstadaptivedemux_class->stream_advance_fragment =
|
gstadaptivedemux_class->stream_advance_fragment =
|
||||||
gst_dash_demux_stream_advance_fragment;
|
gst_dash_demux_stream_advance_fragment;
|
||||||
gstadaptivedemux_class->stream_get_fragment_waiting_time =
|
gstadaptivedemux_class->stream_get_fragment_waiting_time =
|
||||||
|
@ -969,6 +973,16 @@ gst_dash_demux_stream_advance_subfragment (GstAdaptiveDemuxStream * stream)
|
||||||
return !fragment_finished;
|
return !fragment_finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_dash_demux_stream_has_next_fragment (GstAdaptiveDemuxStream * stream)
|
||||||
|
{
|
||||||
|
GstDashDemux *dashdemux = GST_DASH_DEMUX_CAST (stream->demux);
|
||||||
|
GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
|
||||||
|
|
||||||
|
return gst_mpd_client_has_next_segment (dashdemux->client,
|
||||||
|
dashstream->active_stream, stream->demux->segment.rate > 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream)
|
gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3720,6 +3720,21 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_mpd_client_has_next_segment (GstMpdClient * client,
|
||||||
|
GstActiveStream * stream, gboolean forward)
|
||||||
|
{
|
||||||
|
if (forward) {
|
||||||
|
if (stream->segment_index >= stream->segments->len)
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
if (stream->segment_index < 0)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
GstFlowReturn
|
GstFlowReturn
|
||||||
gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream,
|
gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream,
|
||||||
gboolean forward)
|
gboolean forward)
|
||||||
|
|
|
@ -534,6 +534,7 @@ GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client,
|
||||||
guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client);
|
guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client);
|
||||||
|
|
||||||
/* Segment */
|
/* Segment */
|
||||||
|
gboolean gst_mpd_client_has_next_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward);
|
||||||
GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward);
|
GstFlowReturn gst_mpd_client_advance_segment (GstMpdClient * client, GstActiveStream * stream, gboolean forward);
|
||||||
void gst_mpd_client_seek_to_first_segment (GstMpdClient * client);
|
void gst_mpd_client_seek_to_first_segment (GstMpdClient * client);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue