diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2017-03-15 16:45:33 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-05-18 19:04:57 +0200 |
commit | 9267b4a725365e5016e3d17b8bb0f9c35dd1be61 (patch) | |
tree | cef75d1e771cbdd61f7acbd84ef525a0c78763f1 /ext/dash | |
parent | df420cc21f0e71cab8fe8f6ddc0cd9412d8e1b23 (diff) |
dashdemux: Never take more than the current fragment duration for estimations inside the fragment
Taking the average might give us from results.
Diffstat (limited to 'ext/dash')
-rw-r--r-- | ext/dash/gstdashdemux.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index c7f32d705..3c4cb6b49 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -1292,6 +1292,9 @@ gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream) dashstream->actual_position = fragment.timestamp + dashstream->current_sync_sample * dashstream->keyframe_average_distance; + dashstream->actual_position = + MIN (dashstream->actual_position, + fragment.timestamp + stream->fragment.duration); stream->fragment.uri = fragment.uri; stream->fragment.timestamp = GST_CLOCK_TIME_NONE; @@ -1562,13 +1565,17 @@ gst_dash_demux_stream_advance_sync_sample (GstAdaptiveDemuxStream * stream, if (GST_CLOCK_TIME_IS_VALID (target_time)) { GST_LOG_OBJECT (stream->pad, "target_time:%" GST_TIME_FORMAT " fragment ts %" GST_TIME_FORMAT - " average:%" GST_TIME_FORMAT, GST_TIME_ARGS (target_time), + " average:%" GST_TIME_FORMAT " fragment duration:%" GST_TIME_FORMAT, + GST_TIME_ARGS (target_time), GST_TIME_ARGS (dashstream->current_fragment_timestamp), - GST_TIME_ARGS (dashstream->keyframe_average_distance)); + GST_TIME_ARGS (dashstream->keyframe_average_distance), + GST_TIME_ARGS (stream->fragment.duration)); + idx = (target_time - dashstream->current_fragment_timestamp) / - dashstream->keyframe_average_distance; + MIN (dashstream->keyframe_average_distance, + stream->fragment.duration); } GST_DEBUG_OBJECT (stream->pad, @@ -1699,8 +1706,8 @@ gst_dash_demux_stream_get_target_time (GstDashDemux * dashdemux, dashstream->actual_position); if (stream->qos_earliest_time == GST_CLOCK_TIME_NONE) { - GstClockTime run_key_dist = - dashstream->keyframe_average_distance / ABS (stream->segment.rate); + GstClockTime run_key_dist = MIN (dashstream->keyframe_average_distance, + stream->fragment.duration) / ABS (stream->segment.rate); /* If we don't have downstream information (such as at startup or * without live sinks), just get the next time (already updated * in actual_position) */ @@ -1795,7 +1802,9 @@ gst_dash_demux_stream_advance_fragment (GstAdaptiveDemuxStream * stream) if (dashstream->current_sync_sample == -1) dur = 0; else - dur = dashstream->keyframe_average_distance; + dur = + MIN (dashstream->keyframe_average_distance, + stream->fragment.duration); } else if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client) && dashstream->sidx_position != 0 && dashstream->sidx_position != GST_CLOCK_TIME_NONE @@ -2410,7 +2419,8 @@ gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream) idx = (dashstream->target_time - dashstream->current_fragment_timestamp) / - dashstream->keyframe_average_distance; + MIN (dashstream->keyframe_average_distance, + stream->fragment.duration); else if (stream->demux->segment.rate > 0.0) idx = 0; if (idx == 0) @@ -2985,7 +2995,8 @@ gst_dash_demux_handle_isobmff (GstAdaptiveDemux * demux, idx = (dash_stream->target_time - dash_stream->current_fragment_timestamp) / - dash_stream->keyframe_average_distance; + MIN (dash_stream->keyframe_average_distance, + stream->fragment.duration); GST_DEBUG_OBJECT (stream->pad, "target %" GST_TIME_FORMAT " idx %d", GST_TIME_ARGS (dash_stream->target_time), idx); |