[vlc-commits] [Git][videolan/vlc][master] 4 commits: transcode: video: fix message typo
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Aug 26 18:14:22 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
5f070036 by Alaric Senat at 2026-08-26T18:02:01+00:00
transcode: video: fix message typo
- - - - -
942e5bc0 by Alaric Senat at 2026-08-26T18:02:01+00:00
transcode: audio: use a local error variable
As next commit will switch the error flag to an atomic value, this
will avoids unnecessary stores and loads.
- - - - -
9c250745 by Alaric Senat at 2026-08-26T18:02:01+00:00
transcode: make the error flag atomic
To allow error forwarding in now async decoder `update_format` callback.
- - - - -
54a50fd7 by Alaric Senat at 2026-08-26T18:02:01+00:00
transcode: video: handle downstream_add failures
Most (all, as far as I know) decoders won't fail subsequent pf_decode
when a format update fails, which leads to try format updates at every
decodes of the pipeline without ever stopping.
The implemented check requires b_error to be atomic, if one day, all
decoders behave nicely with update_format error handling, this should be
reverted.
- - - - -
4 changed files:
- modules/stream_out/transcode/audio.c
- modules/stream_out/transcode/transcode.c
- modules/stream_out/transcode/transcode.h
- modules/stream_out/transcode/video.c
Changes:
=====================================
modules/stream_out/transcode/audio.c
=====================================
@@ -230,6 +230,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
block_t *p_audio_bufs = transcode_dequeue_all_audios( id );
+ bool error = false;
do
{
block_t *p_audio_buf = p_audio_bufs;
@@ -238,7 +239,7 @@ int transcode_audio_process( sout_stream_t *p_stream,
p_audio_bufs = p_audio_buf->p_next;
p_audio_buf->p_next = NULL;
- if( id->b_error )
+ if( error )
{
block_Release( p_audio_buf );
continue;
@@ -340,14 +341,14 @@ int transcode_audio_process( sout_stream_t *p_stream,
error:
if( p_audio_buf )
block_Release( p_audio_buf );
- id->b_error = true;
+ error = true;
} while( p_audio_bufs );
/* Drain encoder */
- if( unlikely( !id->b_error && in == NULL ) && transcode_encoder_opened( id->encoder ) )
+ if( unlikely( !error && in == NULL ) && transcode_encoder_opened( id->encoder ) )
{
transcode_encoder_drain( id->encoder, out );
}
- return id->b_error ? VLC_EGENERIC : VLC_SUCCESS;
+ return error ? VLC_EGENERIC : VLC_SUCCESS;
}
=====================================
modules/stream_out/transcode/transcode.c
=====================================
@@ -751,7 +751,7 @@ static void Del( sout_stream_t *p_stream, void *_id )
case VIDEO_ES:
/* Drain if we didn't receive an error, otherwise the
* decoder/encoder might not even exist. */
- if(!id->b_error)
+ if( !atomic_load_explicit( &id->b_error, memory_order_acquire ) )
Send( p_stream, id, NULL );
dec_Delete( id->p_decoder );
vlc_mutex_lock( &p_sys->lock );
@@ -784,7 +784,7 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
sout_stream_id_sys_t *id = (sout_stream_id_sys_t *)_id;
block_t *p_out = NULL;
- if( id->b_error )
+ if( atomic_load_explicit(&id->b_error, memory_order_acquire) )
goto error;
if( !id->b_transcode )
@@ -863,7 +863,7 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
}
if (i_ret != VLC_SUCCESS)
- id->b_error = true;
+ atomic_store_explicit( &id->b_error, true, memory_order_release );
return i_ret;
error:
=====================================
modules/stream_out/transcode/transcode.h
=====================================
@@ -78,7 +78,7 @@ struct aout_filters;
struct sout_stream_id_sys_t
{
bool b_transcode;
- bool b_error;
+ atomic_bool b_error;
/* id of the out stream */
void *downstream_id;
=====================================
modules/stream_out/transcode/video.c
=====================================
@@ -119,6 +119,9 @@ static int video_update_format_decoder( decoder_t *p_dec, vlc_video_context *vct
struct decoder_owner *p_owner = dec_get_owner( p_dec );
sout_stream_id_sys_t *id = p_owner->id;
+ if( atomic_load_explicit(&id->b_error, memory_order_acquire) )
+ return VLC_EGENERIC;
+
vlc_mutex_lock(&id->fifo.lock);
if( id->encoder != NULL && transcode_encoder_opened( id->encoder ) )
{
@@ -225,12 +228,22 @@ static int video_update_format_decoder( decoder_t *p_dec, vlc_video_context *vct
id->p_decoder->fmt_in,
transcode_encoder_format_out( id->encoder ),
id->es_id );
- msg_Info( p_dec, "video format update succeed" );
+
+ if( id->downstream_id == NULL )
+ {
+ vlc_mutex_lock( &id->fifo.lock );
+ goto error;
+ }
+
+ msg_Info( p_dec, "video format update success" );
end:
return VLC_SUCCESS;
error:
+
+ atomic_store_explicit( &id->b_error, true, memory_order_release );
+
transcode_remove_filters( &id->p_final_conv_static );
if( transcode_encoder_opened( id->encoder ) )
@@ -263,9 +276,11 @@ static void decoder_queue_video( decoder_t *p_dec, picture_t *p_pic )
if( p_block == NULL )
return;
+ if( ret != VLC_SUCCESS )
+ atomic_store_explicit( &id->b_error, true, memory_order_release );
+
vlc_fifo_Lock( id->output_fifo );
- id->b_error |= ret != VLC_SUCCESS;
- if( id->b_error )
+ if( atomic_load_explicit( &id->b_error, memory_order_acquire ) )
{
vlc_fifo_Unlock( id->output_fifo );
block_ChainRelease( p_block );
@@ -577,7 +592,8 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
* blocks. */
block_t *drained = NULL;
vlc_fifo_Lock( id->output_fifo );
- if( unlikely( !id->b_error && in == NULL ) && transcode_encoder_opened( id->encoder ) )
+ const bool has_error = atomic_load_explicit( &id->b_error, memory_order_acquire );
+ if( unlikely( !has_error && in == NULL ) && transcode_encoder_opened( id->encoder ) )
{
msg_Dbg( p_stream, "Draining thread and waiting for that");
if (transcode_encoder_drain(id->encoder, &drained) == VLC_SUCCESS)
@@ -585,7 +601,6 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
else
msg_Warn( p_stream, "Draining failed");
}
- bool has_error = id->b_error;
if( !has_error )
{
vlc_frame_t *pendings = vlc_fifo_DequeueAllUnlocked( id->output_fifo );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/10a0aecad02f54290a2e8307a8c5ed5e652156e1...54a50fd725c4bc21e002dc3a76e54eb923880764
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/10a0aecad02f54290a2e8307a8c5ed5e652156e1...54a50fd725c4bc21e002dc3a76e54eb923880764
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list