[vlc-devel] [PATCH] decoder: make the maximum buffering size a member of decoder_t, allowing decoder modules to override the default value.
Felix Abecassis
felix.abecassis at gmail.com
Tue Nov 19 16:58:45 CET 2013
---
include/vlc_codec.h | 2 ++
src/input/decoder.c | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 1e7c8a6..a3fc020 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -132,6 +132,8 @@ struct decoder_t
decoder_owner_sys_t *p_owner;
bool b_error;
+
+ int i_max_buffering;
};
/**
diff --git a/src/input/decoder.c b/src/input/decoder.c
index bfa98f4..69b179e 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -814,6 +814,9 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
p_dec->pf_get_display_date = DecoderGetDisplayDate;
p_dec->pf_get_display_rate = DecoderGetDisplayRate;
+ /* Set default value for decoder buffering, can be overriden by the decoder module. */
+ p_dec->i_max_buffering = DECODER_MAX_BUFFERING_COUNT;
+
/* Find a suitable decoder/packetizer module */
if( !b_packetizer )
p_dec->p_module = module_need( p_dec, "decoder", "$codec", false );
@@ -1189,7 +1192,7 @@ static void DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
p_owner->buffer.pp_audio_next = &p_audio->p_next;
p_owner->buffer.i_count++;
- if( p_owner->buffer.i_count > DECODER_MAX_BUFFERING_COUNT ||
+ if( p_owner->buffer.i_count > p_dec->i_max_buffering ||
p_audio->i_pts - p_owner->buffer.p_audio->i_pts > DECODER_MAX_BUFFERING_AUDIO_DURATION )
{
p_owner->buffer.b_full = true;
@@ -1389,7 +1392,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
p_owner->buffer.pp_picture_next = &p_picture->p_next;
p_owner->buffer.i_count++;
- if( p_owner->buffer.i_count > DECODER_MAX_BUFFERING_COUNT ||
+ if( p_owner->buffer.i_count > p_dec->i_max_buffering ||
p_picture->date - p_owner->buffer.p_picture->date > DECODER_MAX_BUFFERING_VIDEO_DURATION )
{
p_owner->buffer.b_full = true;
@@ -2390,7 +2393,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
p_vout, &fmt,
dpb_size +
p_dec->i_extra_picture_buffers +
- 1 + DECODER_MAX_BUFFERING_COUNT,
+ 1 + p_dec->i_max_buffering,
true );
vlc_mutex_lock( &p_owner->lock );
p_owner->p_vout = p_vout;
--
1.8.3.2
More information about the vlc-devel
mailing list