From: David Flynn <dav...@rd.bbc.co.uk> includes: - decoder: fix use of ->size instead of ->n in need_output_frame
Signed-off-by: David Flynn <dav...@rd.bbc.co.uk> --- schroedinger/schrodecoder.c | 34 ++++++++++++++++++++++------------ 1 files changed, 22 insertions(+), 12 deletions(-) diff --git a/schroedinger/schrodecoder.c b/schroedinger/schrodecoder.c index b8238e0..9516726 100644 --- a/schroedinger/schrodecoder.c +++ b/schroedinger/schrodecoder.c @@ -573,14 +573,29 @@ schro_decoder_push_ready (SchroDecoder *decoder) return TRUE; } +static int +schro_decoder_need_output_frame_locked (SchroDecoder *decoder) +{ + int num_frames_in_hand = decoder->output_queue->n; + int i; + for(i=0;i<decoder->reorder_buffer->n;i++){ + SchroPicture *picture = decoder->reorder_buffer->elements[i]; + if (!picture->output_picture) + num_frames_in_hand--; + } + return num_frames_in_hand < 0; +} + int schro_decoder_need_output_frame (SchroDecoder *decoder) { - if (decoder->have_sequence_header && - schro_queue_is_empty (decoder->output_queue)) { - return TRUE; - } - return FALSE; + int ret; + + schro_async_lock (decoder->async); + ret = schro_decoder_need_output_frame_locked (decoder); + schro_async_unlock (decoder->async); + + return ret; } static int @@ -593,13 +608,8 @@ schro_decoder_get_status_locked (SchroDecoder *decoder) return SCHRO_DECODER_ERROR; } if (decoder->sequence_header_buffer && - schro_queue_is_empty (decoder->output_queue)) { - int i; - for(i=0;i<decoder->reorder_buffer->n;i++){ - SchroPicture *picture = decoder->reorder_buffer->elements[i]; - if (!picture->output_picture) - return SCHRO_DECODER_NEED_FRAME; - } + schro_decoder_need_output_frame_locked (decoder)) { + return SCHRO_DECODER_NEED_FRAME; } if (!schro_queue_is_full (decoder->reorder_buffer) && !decoder->flushing) { return SCHRO_DECODER_NEED_BITS; -- 1.5.6.5 ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Schrodinger-devel mailing list Schrodinger-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/schrodinger-devel