hlsdemux2: Print playlist age in debug output
Store the timestamp when playlists are updated, and add some debug output to the update_fragment_info that estimates how far from the live edge the fragment currently is Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
parent
43e042c4b7
commit
401ca3ef44
@ -2308,6 +2308,8 @@ gst_hls_demux_stream_update_media_playlist (GstHLSDemux * demux,
|
|||||||
GST_WARNING_OBJECT (stream, "Could not get playlist '%s'", *uri);
|
GST_WARNING_OBJECT (stream, "Could not get playlist '%s'", *uri);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
stream->playlist_last_update_time =
|
||||||
|
gst_adaptive_demux2_get_monotonic_time (GST_ADAPTIVE_DEMUX (demux));
|
||||||
|
|
||||||
/* Check if a redirect happened */
|
/* Check if a redirect happened */
|
||||||
if (g_strcmp0 (*uri, new_playlist->uri)) {
|
if (g_strcmp0 (*uri, new_playlist->uri)) {
|
||||||
@ -2363,7 +2365,8 @@ gst_hls_demux_stream_update_media_playlist (GstHLSDemux * demux,
|
|||||||
gst_hls_media_playlist_sync_to_segment (new_playlist,
|
gst_hls_media_playlist_sync_to_segment (new_playlist,
|
||||||
stream->current_segment);
|
stream->current_segment);
|
||||||
|
|
||||||
/* FIXME: Handle LL-HLS partial segment sync */
|
/* Handle LL-HLS partial segment sync by checking our partial segment
|
||||||
|
* still makes sense */
|
||||||
if (stream->in_partial_segments && new_segment) {
|
if (stream->in_partial_segments && new_segment) {
|
||||||
/* We must be either playing the trailing open-ended partial segment,
|
/* We must be either playing the trailing open-ended partial segment,
|
||||||
* or if we're playing partials from a complete segment, check that we
|
* or if we're playing partials from a complete segment, check that we
|
||||||
@ -2529,10 +2532,20 @@ gst_hls_demux_stream_update_fragment_info (GstAdaptiveDemux2Stream * stream)
|
|||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
GstClockTimeDiff live_edge_dist =
|
||||||
|
GST_CLOCK_TIME_IS_VALID (stream->current_position) ?
|
||||||
|
gst_hls_media_playlist_get_end_stream_time (hlsdemux_stream->playlist) -
|
||||||
|
stream->current_position : GST_CLOCK_TIME_NONE;
|
||||||
|
GstClockTime playlist_age =
|
||||||
|
gst_adaptive_demux2_get_monotonic_time (GST_ADAPTIVE_DEMUX (demux)) -
|
||||||
|
hlsdemux_stream->playlist_last_update_time;
|
||||||
GST_DEBUG_OBJECT (stream,
|
GST_DEBUG_OBJECT (stream,
|
||||||
"Updating fragment information, current_position:%" GST_TIME_FORMAT,
|
"Updating fragment information, current_position:%" GST_TIME_FORMAT
|
||||||
GST_TIME_ARGS (stream->current_position));
|
" which is %" GST_STIME_FORMAT " from live edge. Playlist age %"
|
||||||
|
GST_TIME_FORMAT, GST_TIME_ARGS (stream->current_position),
|
||||||
|
GST_STIME_ARGS (live_edge_dist), GST_TIME_ARGS (playlist_age));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find the current segment if we don't already have it */
|
/* Find the current segment if we don't already have it */
|
||||||
if (hlsdemux_stream->current_segment == NULL) {
|
if (hlsdemux_stream->current_segment == NULL) {
|
||||||
|
@ -111,6 +111,7 @@ struct _GstHLSDemuxStream
|
|||||||
|
|
||||||
/* Whether the underlying playlist was fetched on creation */
|
/* Whether the underlying playlist was fetched on creation */
|
||||||
gboolean playlist_fetched;
|
gboolean playlist_fetched;
|
||||||
|
GstClockTime playlist_last_update_time;
|
||||||
|
|
||||||
/* The media playlist currently used */
|
/* The media playlist currently used */
|
||||||
GstHLSMediaPlaylist *playlist;
|
GstHLSMediaPlaylist *playlist;
|
||||||
|
@ -2146,6 +2146,18 @@ out:
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GstClockTime
|
||||||
|
gst_hls_media_playlist_get_end_stream_time (GstHLSMediaPlaylist * m3u8)
|
||||||
|
{
|
||||||
|
if (m3u8->segments->len == 0)
|
||||||
|
return GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
|
GstM3U8MediaSegment *last =
|
||||||
|
g_ptr_array_index (m3u8->segments, m3u8->segments->len - 1);
|
||||||
|
|
||||||
|
return last->stream_time + last->duration;
|
||||||
|
}
|
||||||
|
|
||||||
GstClockTime
|
GstClockTime
|
||||||
gst_hls_media_playlist_get_duration (GstHLSMediaPlaylist * m3u8)
|
gst_hls_media_playlist_get_duration (GstHLSMediaPlaylist * m3u8)
|
||||||
{
|
{
|
||||||
|
@ -294,6 +294,9 @@ gboolean
|
|||||||
gst_hls_media_playlist_get_starting_segment (GstHLSMediaPlaylist *self, gboolean low_latency,
|
gst_hls_media_playlist_get_starting_segment (GstHLSMediaPlaylist *self, gboolean low_latency,
|
||||||
GstM3U8SeekResult *seek_result);
|
GstM3U8SeekResult *seek_result);
|
||||||
|
|
||||||
|
GstClockTime
|
||||||
|
gst_hls_media_playlist_get_end_stream_time (GstHLSMediaPlaylist * m3u8);
|
||||||
|
|
||||||
GstClockTime
|
GstClockTime
|
||||||
gst_hls_media_playlist_get_duration (GstHLSMediaPlaylist * m3u8);
|
gst_hls_media_playlist_get_duration (GstHLSMediaPlaylist * m3u8);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user