[vlc-commits] [Git][videolan/vlc][master] 2 commits: decoder: check block_Duplicate() return
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 6 18:22:03 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
da7fc261 by Thomas Guillem at 2023-10-06T18:01:56+00:00
decoder: check block_Duplicate() return
- - - - -
115fb69e by Thomas Guillem at 2023-10-06T18:01:56+00:00
decoder: optimize locking in DecoderPlayCc()
The mutex was unlocked and locked right after when DecoderPlayCc() was
called from PacketizerGetCc().
- - - - -
1 changed file:
- src/input/decoder.c
Changes:
=====================================
src/input/decoder.c
=====================================
@@ -1170,13 +1170,12 @@ static void DecoderThread_ProcessSout( vlc_input_decoder_t *p_owner, vlc_frame_t
}
}
-static void DecoderPlayCc( vlc_input_decoder_t *p_owner, vlc_frame_t *p_cc,
- const decoder_cc_desc_t *p_desc )
+static void DecoderPlayCcLocked( vlc_input_decoder_t *p_owner, vlc_frame_t *p_cc,
+ const decoder_cc_desc_t *p_desc )
{
- vlc_fifo_Lock(p_owner->p_fifo);
+ vlc_fifo_Assert(p_owner->p_fifo);
if (p_owner->flushing || p_owner->aborting)
{
- vlc_fifo_Unlock(p_owner->p_fifo);
vlc_frame_Release(p_cc);
return;
}
@@ -1197,7 +1196,10 @@ static void DecoderPlayCc( vlc_input_decoder_t *p_owner, vlc_frame_t *p_cc,
if( i_bitmap > 1 )
{
- block_FifoPut( p_ccowner->p_fifo, block_Duplicate(p_cc) );
+ block_t *dup = block_Duplicate(p_cc);
+ if (dup == NULL)
+ break;
+ block_FifoPut(p_ccowner->p_fifo, dup);
}
else
{
@@ -1207,8 +1209,6 @@ static void DecoderPlayCc( vlc_input_decoder_t *p_owner, vlc_frame_t *p_cc,
}
vlc_mutex_unlock(&p_owner->cc.lock);
- vlc_fifo_Unlock(p_owner->p_fifo);
-
if( p_cc ) /* can have bitmap set but no created decs */
block_Release( p_cc );
}
@@ -1228,9 +1228,7 @@ static void PacketizerGetCc( vlc_input_decoder_t *p_owner, decoder_t *p_dec_cc )
if( !p_cc )
return;
- vlc_fifo_Unlock(p_owner->p_fifo);
- DecoderPlayCc( p_owner, p_cc, &desc );
- vlc_fifo_Lock(p_owner->p_fifo);
+ DecoderPlayCcLocked( p_owner, p_cc, &desc );
}
static void ModuleThread_QueueCc( decoder_t *p_videodec, vlc_frame_t *p_cc,
@@ -1248,7 +1246,9 @@ static void ModuleThread_QueueCc( decoder_t *p_videodec, vlc_frame_t *p_cc,
return;
}
- DecoderPlayCc(p_owner, p_cc, p_desc);
+ vlc_fifo_Lock(p_owner->p_fifo);
+ DecoderPlayCcLocked(p_owner, p_cc, p_desc);
+ vlc_fifo_Unlock(p_owner->p_fifo);
}
static int ModuleThread_PlayVideo( vlc_input_decoder_t *p_owner, picture_t *p_picture )
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7aa694034e59db50cc6b5e1ea2aac26d121558b4...115fb69e2e79877b6a237b92266fe9a0aa6b1049
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7aa694034e59db50cc6b5e1ea2aac26d121558b4...115fb69e2e79877b6a237b92266fe9a0aa6b1049
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list