[vlc-devel] [PATCH 43/48] hls: Don't sleep if we don't have at least 3 segments pre-loaded.

Hugo Beauzée-Luyssen beauze.h at gmail.com
Mon Jan 9 16:16:52 CET 2012


---
 modules/stream_filter/httplive.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 21a09af..ae098b9 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1534,7 +1534,9 @@ static void* hls_Thread(void *p_this)
 
         /* Wait to be wake up when a new segment is needed */
         vlc_mutex_lock(&p_sys->download.lock_wait);
-        vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait);
+        /* Don't sleep if we don't have at least 3 segments pre-loaded */
+        if ( p_sys->download.segment - p_sys->playback.segment > 3 )
+            vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait);
         vlc_mutex_unlock(&p_sys->download.lock_wait);
 
         if (!vlc_object_alive(s) || p_sys->b_quit)
-- 
1.7.8.3




More information about the vlc-devel mailing list