[vlc-devel] [PATCH] input/stream_demux: pace control

Frédéric Yhuel yhuelf at gmail.com
Sat Oct 27 11:14:54 CEST 2012


---
 src/input/stream_demux.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/input/stream_demux.c b/src/input/stream_demux.c
index 5f05217..169c874 100644
--- a/src/input/stream_demux.c
+++ b/src/input/stream_demux.c
@@ -25,8 +25,10 @@
 # include "config.h"
 #endif
 #include <limits.h>
+#include <assert.h>
 
 #include "demux.h"
+#include "es_out.h"
 #include <libvlc.h>
 #include <vlc_codec.h>
 
@@ -313,6 +315,7 @@ static void* DStreamThread( void *obj )
     stream_t *s = (stream_t *)obj;
     stream_sys_t *p_sys = s->p_sys;
     demux_t *p_demux;
+    mtime_t i_delta = 0;
 
     /* Create the demuxer */
     p_demux = demux_New( s, s->p_input, "", p_sys->psz_name, "", s, p_sys->out,
@@ -350,6 +353,10 @@ static void* DStreamThread( void *obj )
             next_update = mdate() + (CLOCK_FREQ / 4);
         }
 
+        i_delta = es_out_GetWakeup( p_demux->out ) - mdate();
+        if( i_delta >= VLC_HARD_MIN_SLEEP )
+            msleep( i_delta );
+
         if( demux_Demux( p_demux ) <= 0 )
             break;
     }
-- 
1.7.9.5



More information about the vlc-devel mailing list