diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index e7420ec2ef..03fd66c278 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -4154,10 +4154,11 @@ gst_mpd_client_get_next_fragment_duration (GstMpdClient * client, g_return_val_if_fail (stream->cur_seg_template->MultSegBaseType-> SegmentTimeline == NULL, 0); - if (GST_CLOCK_TIME_IS_VALID (duration) || segments_count == 0 - || seg_idx < segments_count) - return duration; - return 0; + if (!GST_CLOCK_TIME_IS_VALID (duration) || (segments_count > 0 + && seg_idx >= segments_count)) { + return 0; + } + return duration; } }