[vlc-devel] [PATCH] playlist: prevent playing an invalid playlist indefinitely

Zhao Zhili wantlamy at gmail.com
Wed Feb 24 06:16:35 CET 2016


---
 src/playlist/thread.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index a348479..21bb090 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -498,6 +498,8 @@ static void *Thread ( void *data )
             continue;
         }

+        int count = 0;
+        mtime_t i_time = 0;
         while( !p_sys->killed && Next( p_playlist ) )
         {   /* Playlist in running state */
             assert(p_sys->p_input != NULL);
@@ -505,6 +507,18 @@ static void *Thread ( void *data )
             do
                 LoopInput( p_playlist );
             while( p_sys->p_input != NULL );
+
+            /* prevent playing an invalid playlist indefinitely */
+            if( mdate() - i_time < 500000 )
+            {
+                count++;
+                if( count > p_playlist->current.i_size )
+                    break;
+            }
+            else
+                count = 0;
+
+            i_time = mdate();
         }

         msg_Dbg( p_playlist, "nothing to play" );
-- 
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160224/0356635a/attachment.html>


More information about the vlc-devel mailing list