[vlc-devel] [PATCH] input: export decode fifo size to options

Tzu-Jung Lee roylee17 at gmail.com
Sun Jul 28 09:23:03 CEST 2013


Signed-off-by: Tzu-Jung Lee <tjlee at ambarella.com>
---

I'm wondering does this patch help?
(help message can be revised during merged, if it's going to be.)

 src/input/decoder.c |  9 ++++-----
 src/libvlc-module.c | 15 ++++++++++++++-
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index b1b038c..f9a583c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -290,6 +290,9 @@ static decoder_t *decoder_New( vlc_object_t *p_parent, input_thread_t *p_input,
     p_dec->p_owner->p_clock = p_clock;
     assert( p_dec->fmt_out.i_cat != UNKNOWN_ES );
 
+    p_dec->p_owner->i_fifo_size = var_InheritInteger( p_dec, "decoder-fifo" );
+
+    msg_Dbg( p_dec, "decoder-fifo: 0x%x bytes", p_dec->p_owner->i_fifo_size );
     if( p_dec->fmt_out.i_cat == AUDIO_ES )
         i_priority = VLC_THREAD_PRIORITY_AUDIO;
     else
@@ -393,11 +396,7 @@ void input_DecoderDecode( decoder_t *p_dec, block_t *p_block, bool b_do_pace )
         if( !p_owner->b_buffering )
             block_FifoPace( p_owner->p_fifo, 10, SIZE_MAX );
     }
-#ifdef __arm__
-    else if( block_FifoSize( p_owner->p_fifo ) > 50*1024*1024 /* 50 MiB */ )
-#else
-    else if( block_FifoSize( p_owner->p_fifo ) > 400*1024*1024 /* 400 MiB, ie ~ 50mb/s for 60s */ )
-#endif
+    else if( block_FifoSize( p_owner->p_fifo ) > p_owner->i_fifo_size)
     {
         /* FIXME: ideally we would check the time amount of data
          * in the FIFO instead of its size. */
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 94faf8e..a29df0c 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -634,6 +634,11 @@ static const char *const ppsz_prefres[] = {
 #define RUN_TIME_LONGTEXT N_( \
     "The stream will run this duration (in seconds)." )
 
+#define DECODER_FIFO_TEXT N_("Decode fifo size (in bytes)")
+#define DECODER_FIFO_LONGTEXT N_( \
+    "This changes the fifo size of decoder, which is default to 50 MB " \
+    "for ARM, and 400 MB for other platforms" )
+
 #define INPUT_FAST_SEEK_TEXT N_("Fast seek")
 #define INPUT_FAST_SEEK_LONGTEXT N_( \
     "Favor speed over precision while seeking" )
@@ -1715,9 +1720,17 @@ vlc_module_begin ()
     add_bool( "input-fast-seek", false,
               INPUT_FAST_SEEK_TEXT, INPUT_FAST_SEEK_LONGTEXT, false )
         change_safe ()
+#ifdef __arm__
+    /* 50 MiB */
+    add_integer( "decoder-fifo", 50, DECODER_FIFO_TEXT,
+                 DECODER_FIFO_LONGTEXT, false )
+#else
+    /* 400 MiB, ie ~ 50mb/s for 60s */ )
+    add_integer( "decoder-fifo", 400, DECODER_FIFO_TEXT,
+                 DECODER_FIFO_LONGTEXT, false )
+#endif
     add_float( "rate", 1.,
                INPUT_RATE_TEXT, INPUT_RATE_LONGTEXT, false )
-
     add_string( "input-list", NULL,
                  INPUT_LIST_TEXT, INPUT_LIST_LONGTEXT, true )
     add_string( "input-slave", NULL,
-- 
1.8.3.2




More information about the vlc-devel mailing list