[vlc-commits] httplive: have some sane max_duration_length

Ilkka Ollakka git at videolan.org
Thu Mar 6 13:15:25 CET 2014


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Mar  2 13:04:56 2014 +0200| [f4254943bb0fd22f3dd4e4036513f2f1a3effe21] | committer: Ilkka Ollakka

httplive: have some sane max_duration_length

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f4254943bb0fd22f3dd4e4036513f2f1a3effe21
---

 modules/stream_filter/httplive.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 4445f6e..c0e6cc3 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1756,8 +1756,12 @@ static void* hls_Reload(void *p_this)
 
             /* 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);



More information about the vlc-commits mailing list