[vlc-devel] [PATCH] avcodec: Fix unprotected accesses to pts
Rémi Denis-Courmont
remi at remlab.net
Wed Oct 2 13:15:36 CEST 2019
This does not look right. If Flush really does what it's supposed to do, no other thread should be racing for the PTS.
Le 2 octobre 2019 13:05:40 GMT+03:00, "Hugo Beauzée-Luyssen" <hugo at beauzee.fr> a écrit :
>---
> modules/codec/avcodec/video.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/modules/codec/avcodec/video.c
>b/modules/codec/avcodec/video.c
>index d69abd7419..911fee2f8b 100644
>--- a/modules/codec/avcodec/video.c
>+++ b/modules/codec/avcodec/video.c
>@@ -702,7 +702,10 @@ static void Flush( decoder_t *p_dec )
> decoder_sys_t *p_sys = p_dec->p_sys;
> AVCodecContext *p_context = p_sys->p_context;
>
>+ vlc_mutex_lock(&p_sys->lock);
>date_Set(&p_sys->pts, VLC_TICK_INVALID); /* To make sure we recover
>properly */
>+ vlc_mutex_unlock(&p_sys->lock);
>+
> p_sys->i_late_frames = 0;
> p_sys->framedrop = FRAMEDROP_NONE;
> cc_Flush( &p_sys->cc );
>@@ -759,7 +762,9 @@ static block_t * filter_earlydropped_blocks(
>decoder_t *p_dec, block_t *block )
> "dropping frame (computer too slow ?)",
> p_sys->p_context->reordered_opaque - p_sys->i_last_output_frame );
>
>+ vlc_mutex_lock(&p_sys->lock);
>date_Set( &p_sys->pts, VLC_TICK_INVALID ); /* To make sure we recover
>properly */
>+ vlc_mutex_unlock(&p_sys->lock);
> block_Release( block );
> p_sys->i_late_frames--;
> return NULL;
>@@ -1339,7 +1344,10 @@ static int DecodeVideo( decoder_t *p_dec,
>block_t *p_block )
> p_sys->i_last_output_frame = -1;
> p_sys->framedrop = FRAMEDROP_NONE;
>
>+ vlc_mutex_lock(&p_sys->lock);
>date_Set( &p_sys->pts, VLC_TICK_INVALID ); /* To make sure we recover
>properly */
>+ vlc_mutex_unlock(&p_sys->lock);
>+
> cc_Flush( &p_sys->cc );
>
> if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
>--
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20191002/140667ef/attachment.html>
More information about the vlc-devel
mailing list