[vlc-devel] [PATCH] input: add ES_OUT_FORCE_PACE_CONTROL request

Frédéric Yhuel yhuelf at gmail.com
Tue Oct 30 14:52:07 CET 2012


This is useful to avoid too heavy buffering when the input cannot have
its speed controlled. In practice, depth of decoders' FIFO would stay
below 10.
---
 include/vlc_es_out.h         |    3 +++
 src/input/es_out.c           |    6 ++++++
 src/input/es_out_timeshift.c |    3 +++
 3 files changed, 12 insertions(+)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index cf1abce..3f6b190 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -89,6 +89,9 @@ enum es_out_query_e
     ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
     ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */
 
+    /* Will limit depth of decoders' queue (see input/decoder.c:input_DecoderDecode) */
+    ES_OUT_FORCE_PACE_CONTROL,                      /* res=cannot fail */
+
     /* First value usable for private control */
     ES_OUT_PRIVATE_START = 0x10000,
 };
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 0ac7cf5..e209a7b 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2679,6 +2679,12 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
         return VLC_SUCCESS;
     }
 
+    case ES_OUT_FORCE_PACE_CONTROL:
+    {
+        p_sys->p_input->p->b_out_pace_control = true;
+        return VLC_SUCCESS;
+    }
+
     default:
         msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
         return VLC_EGENERIC;
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 4f5db4f..4841d43 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -608,6 +608,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
     case ES_OUT_SET_TIMES:
     case ES_OUT_SET_JITTER:
     case ES_OUT_SET_EOS:
+    case ES_OUT_FORCE_PACE_CONTROL:
     {
         ts_cmd_t cmd;
         if( CmdInitControl( &cmd, i_query, args, p_sys->b_delayed ) )
@@ -1330,6 +1331,7 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
 
     case ES_OUT_RESET_PCR:           /* no arg */
     case ES_OUT_SET_EOS:
+    case ES_OUT_FORCE_PACE_CONTROL:
         break;
 
     case ES_OUT_SET_META:        /* arg1=const vlc_meta_t* */
@@ -1466,6 +1468,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
 
     case ES_OUT_RESET_PCR:           /* no arg */
     case ES_OUT_SET_EOS:
+    case ES_OUT_FORCE_PACE_CONTROL:
         return es_out_Control( p_out, i_query );
 
     case ES_OUT_SET_GROUP_META:  /* arg1=int i_group arg2=const vlc_meta_t* */
-- 
1.7.9.5



More information about the vlc-devel mailing list