Regression from
ac3f61953b25a61cf46c16badcfd2a24f890b83e as without this
there could be negative/zero max_duration_length if playlist didn't
change and it would cause instantenious refetch of that playlist.
/* determine next time to update playlist */
p_sys->playlist.last = now;
- p_sys->playlist.wakeup = now + ((mtime_t)(hls->max_segment_length * wait)
- * (mtime_t)1000000);
+ p_sys->playlist.wakeup = now;
+ /* If there is no new segments,use playlist duration as sleep period base */
+ if( likely( hls->max_segment_length > 0 ) )
+ p_sys->playlist.wakeup += (mtime_t)((hls->max_segment_length * wait) * CLOCK_FREQ);
+ else
+ p_sys->playlist.wakeup += (mtime_t)((hls->duration * wait) * CLOCK_FREQ);
}
mwait(p_sys->playlist.wakeup);