httplive module takes all cpu power when playing live stream
authorLuc Saillard <luc.saillard@sfr.com>
Wed, 20 Jul 2011 15:42:13 +0000 (17:42 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 22 Jul 2011 00:22:25 +0000 (02:22 +0200)
When playing a live stream, the thread didn't wait for an event, so it's
like a while(1)... Just wait until we read/need a new segment.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/stream_filter/httplive.c

index 7994430..cc3fe48 100644 (file)
@@ -1206,10 +1206,11 @@ static void* hls_Thread(void *p_this)
                     (p_sys->download.segment >= count)) &&
                    (p_sys->download.seek == -1))
             {
+                vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait);
                 if (p_sys->b_live /*&& (mdate() >= p_sys->playlist.wakeup)*/)
                     break;
-                vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait);
-                if (!vlc_object_alive(s)) break;
+                if (!vlc_object_alive(s))
+                    break;
             }
             /* */
             if (p_sys->download.seek >= 0)