[vlc-devel] [PATCH] decoder: fix mistake old picture and audio block for the first one

Zhao Zhili quinkblack at foxmail.com
Tue Jan 2 16:55:19 CET 2018


> On 2 Jan 2018, at 11:45 PM, Zhao Zhili <quinkblack at foxmail.com> wrote:
> 
> ---
> src/input/decoder.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index b94d6da169..849ff26458 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -987,6 +987,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
> {
>     decoder_owner_sys_t *p_owner = p_dec->p_owner;
>     vout_thread_t  *p_vout = p_owner->p_vout;
> +    bool flushing;
>     bool prerolled;
> 
>     vlc_mutex_lock( &p_owner->lock );
> @@ -1029,6 +1030,16 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
> 
>     if( p_owner->b_waiting )
>     {
> +        vlc_fifo_Lock( p_owner->p_fifo );
> +        flushing = p_owner->flushing;
> +        vlc_fifo_Unlock( p_owner->p_fifo );
> +        if( flushing )
> +        {
> +            vlc_mutex_unlock( &p_owner->lock );
> +            picture_Release( p_picture );
> +            return -1;
> +        }
> +
>         assert( p_owner->b_first );
>         msg_Dbg( p_dec, "Received first picture" );
>         p_owner->b_first = false;
> @@ -1127,6 +1138,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
>                              unsigned *restrict pi_lost_sum )
> {
>     decoder_owner_sys_t *p_owner = p_dec->p_owner;
> +    bool flushing;
>     bool prerolled;
> 
>     assert( p_audio != NULL );
> @@ -1164,6 +1176,16 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
>     vlc_mutex_lock( &p_owner->lock );
>     if( p_owner->b_waiting )
>     {
> +        vlc_fifo_Lock( p_owner->p_fifo );
> +        flushing = p_owner->flushing;
> +        vlc_fifo_Unlock( p_owner->p_fifo );
> +        if( flushing )
> +        {
> +            vlc_mutex_unlock( &p_owner->lock );
> +            block_Release( p_audio );
> +            return -1;
> +        }
> +
>         p_owner->b_has_data = true;
>         vlc_cond_signal( &p_owner->wait_acknowledge );
>     }
> -- 
> 2.14.2
> 

This patch is a replacement of https://mailman.videolan.org/pipermail/vlc-devel/2018-January/117176.html


Here is a test case on MacOS, you can see one old picture is treated as the first picture after seek, and another old picture set the b_has_data flag.

  1022     if( p_owner->b_waiting && !p_owner->b_first )
  1023     {
  1024         p_owner->b_has_data = true;
  1025         vlc_cond_signal( &p_owner->wait_acknowledge );
  1026     }

[00007fb3d2e46500] main decoder error: picture date 48.250000
[00007fb3d2e46500] main decoder error: picture date 48.291667
[00007fb3d2e46500] main decoder error: picture date 48.333334

[00007fb3d2e46500] main decoder error: Received first picture, date 48.375001
[00007fb3d2e46500] main decoder error: picture date 48.375001

[00007fb3d2e46500] main decoder error: Timestamp conversion failed (delay 1000000, buffering 100000, bound 9000000)
[00007fb3d2e46500] main decoder error: Could not convert timestamp 2492382345 for videotoolbox

[00007fb3d2e46500] main decoder error: signal wait, picture date 48.416667
[00007fb3d2e46500] main decoder error: picture date 48.416667

[00007fb3d2e46500] main decoder error: Timestamp conversion failed (delay 1000000, buffering 100000, bound 9000000)
[00007fb3d2e46500] main decoder error: Could not convert timestamp 2489780034 for videotoolbox
[00007fb3d2e46500] main decoder warning: early picture skipped
[00007fb3d2d04930] auhal audio output warning: underrun of 8192 bytes
[00007fb3d2e46500] main decoder error: now flushing picture
[00007fb3d2e46500] main decoder error: picture date 22.541667
[00007fb3d4091af0] main video output warning: picture is too late to be displayed (missing 111 ms)
[00007fb3d2e46500] main decoder error: picture date 22.583333
[00007fb3d4091af0] main video output warning: picture is too late to be displayed (missing 72 ms)
[00007fb3d2e46500] main decoder error: picture date 22.625001
[00007fb3d4091af0] main video output warning: picture is too late to be displayed (missing 32 ms)
[00007fb3d2e46500] main decoder error: picture date 22.666667

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: incorrect-first-picture.txt
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180102/3f6a3ce9/attachment-0001.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: master-test.patch
Type: application/octet-stream
Size: 1351 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180102/3f6a3ce9/attachment-0001.obj>


More information about the vlc-devel mailing list