[vlc-commits] decoder: fix pf_decode_* and pf_packetize behavior
Thomas Guillem
git at videolan.org
Mon Dec 21 15:52:57 CET 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 14 15:53:53 2015 +0100| [16cd51ee8927e3fa23d3b39b739cc059f23bec15] | committer: Thomas Guillem
decoder: fix pf_decode_* and pf_packetize behavior
Audio, video, and sub decoders were not drained. Indeed, pf_decode_* functions
were called with *pp_block == NULL instead of pp_block == NULL. There was no
way to distinguish a drain from an other call from the decoder loop.
There was also an issue with the packetizer. Indeed, a successful call to
pf_packetize leaded to a drain.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16cd51ee8927e3fa23d3b39b739cc059f23bec15
---
src/input/decoder.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 4160d26..1f4cdfd 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -726,9 +726,10 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
block_t *p_sout_block;
+ block_t **pp_block = p_block ? &p_block : NULL;
while( ( p_sout_block =
- p_dec->pf_packetize( p_dec, p_block ? &p_block : NULL ) ) )
+ p_dec->pf_packetize( p_dec, pp_block ) ) )
{
if( p_owner->p_sout_input == NULL )
{
@@ -972,11 +973,12 @@ static int DecoderQueueVideo( decoder_t *p_dec, picture_t *p_pic )
static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
{
picture_t *p_pic;
+ block_t **pp_block = p_block ? &p_block : NULL;
int i_lost = 0;
int i_decoded = 0;
int i_displayed = 0;
- while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) )
+ while( (p_pic = p_dec->pf_decode_video( p_dec, pp_block ) ) )
{
i_decoded++;
@@ -998,10 +1000,11 @@ static void DecoderProcessVideo( decoder_t *p_dec, block_t *p_block )
if( p_owner->p_packetizer )
{
block_t *p_packetized_block;
+ block_t **pp_block = p_block ? &p_block : NULL;
decoder_t *p_packetizer = p_owner->p_packetizer;
while( (p_packetized_block =
- p_packetizer->pf_packetize( p_packetizer, p_block ? &p_block : NULL )) )
+ p_packetizer->pf_packetize( p_packetizer, pp_block ) ) )
{
if( !es_format_IsSimilar( &p_dec->fmt_in, &p_packetizer->fmt_out ) )
{
@@ -1154,11 +1157,12 @@ static int DecoderQueueAudio( decoder_t *p_dec, block_t *p_aout_buf )
static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
{
block_t *p_aout_buf;
+ block_t **pp_block = p_block ? &p_block : NULL;
int i_decoded = 0;
int i_lost = 0;
int i_played = 0;
- while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
+ while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, pp_block ) ) )
{
i_decoded++;
@@ -1180,10 +1184,11 @@ static void DecoderProcessAudio( decoder_t *p_dec, block_t *p_block )
if( p_owner->p_packetizer )
{
block_t *p_packetized_block;
+ block_t **pp_block = p_block ? &p_block : NULL;
decoder_t *p_packetizer = p_owner->p_packetizer;
while( (p_packetized_block =
- p_packetizer->pf_packetize( p_packetizer, p_block ? &p_block : NULL )) )
+ p_packetizer->pf_packetize( p_packetizer, pp_block ) ) )
{
if( !es_format_IsSimilar( &p_dec->fmt_in, &p_packetizer->fmt_out ) )
{
@@ -1305,8 +1310,9 @@ static int DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block )
{
subpicture_t *p_spu;
+ block_t **pp_block = p_block ? &p_block : NULL;
- while( (p_spu = p_dec->pf_decode_sub( p_dec, p_block ? &p_block : NULL ) ) )
+ while( (p_spu = p_dec->pf_decode_sub( p_dec, pp_block ) ) )
DecoderQueueSpu( p_dec, p_spu );
}
More information about the vlc-commits
mailing list