]> git.sesse.net Git - vlc/commitdiff
httplive: have some sane max_duration_length
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 2 Mar 2014 11:04:56 +0000 (13:04 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Thu, 6 Mar 2014 12:09:44 +0000 (14:09 +0200)
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.

modules/stream_filter/httplive.c

index 4445f6e7abc635b30fa8bc6b9b699fb8563e8215..c0e6cc3943939565edac7a2c0d21147e736b552d 100644 (file)
@@ -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);