[vlc-commits] [Git][videolan/vlc][master] 3 commits: decoder: update out state on new vout
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Jul 7 17:05:15 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
13e48832 by Thomas Guillem at 2026-07-07T16:24:28+00:00
decoder: update out state on new vout
- - - - -
87d75fcb by Thomas Guillem at 2026-07-07T16:24:28+00:00
decoder: fix possible invalid out state when format is changed
This commit delay the out state update after the current pf_decode() call.
This fixes the following race condition:
1/ DecoderThread is inside pf_decode()
2/ vlc_input_decoder_ChangePause() is called: owner->paused = true;
3/ decoder_Update*Format() is called from pf_decode(), it pauses the output
4/ A frame is queued while the output it paused
It caused the following assert:
```
Thread 29 Crashed:
0 libsystem_kernel.dylib 0x00000001be1aabbc __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x00000001de815844 pthread_kill + 208 (pthread.c:1668)
2 libsystem_c.dylib 0x000000018ecea6ac abort + 124 (abort.c:118)
3 libsystem_c.dylib 0x000000018ed3e6d8 __assert_rtn + 268 (assert.c:96)
4 VLCKit 0x0000000104c86608 vlc_aout_stream_Play + 188 (dec.c:876)
5 VLCKit 0x0000000104c32060 ModuleThread_PlayAudio + 684 (decoder.c:1680)
6 VLCKit 0x0000000104c318a8 ModuleThread_QueueAudio + 252 (decoder.c:1711)
7 VLCKit 0x000000010473b6d0 decoder_QueueAudio + 320 (vlc_codec.h:476)
8 VLCKit 0x000000010473b024 DecodeBlock + 1800 (audio.c:464)
9 VLCKit 0x000000010473a730 DecodeAudio + 108 (audio.c:513)
10 VLCKit 0x0000000104c336ec DecoderThread_DecodeBlock + 168 (decoder.c:1793)
11 VLCKit 0x0000000104c2ad14 DecoderThread_ProcessInput + 1036 (decoder.c:1919)
12 VLCKit 0x0000000104c2da30 DecoderThread + 1112 (decoder.c:2072)
13 libsystem_pthread.dylib 0x00000001de80b338 _pthread_start + 116 (pthread.c:891)
14 libsystem_pthread.dylib 0x00000001de809938 thread_start + 8 (:-1)
```
This could happen with any states or any type of modules.
Co-Authored-By: Felix Paul Kühne <fkuehne at videolan.org>
- - - - -
8115e53b by Thomas Guillem at 2026-07-07T16:24:28+00:00
decoder: rename UpdateOutState() to ReapplyOutState()
- - - - -
1 changed file:
- src/input/decoder.c
Changes:
=====================================
src/input/decoder.c
=====================================
@@ -505,16 +505,16 @@ static void Decoder_ChangeOutputDelay( vlc_input_decoder_t *p_owner, vlc_tick_t
p_owner->output_delay = delay;
}
-static void Decoder_UpdateOutState(vlc_input_decoder_t *owner)
+static void Decoder_ReapplyOutState(vlc_input_decoder_t *owner)
{
- if (owner->paused)
- Decoder_ChangeOutputPause(owner, owner->paused, owner->pause_date);
+ if (owner->output_paused)
+ Decoder_ChangeOutputPause(owner, owner->output_paused, owner->pause_date);
- if (owner->rate != 1.f)
- Decoder_ChangeOutputRate(owner, owner->rate);
+ if (owner->output_rate != 1.f)
+ Decoder_ChangeOutputRate(owner, owner->output_rate);
- if (owner->delay != 0)
- Decoder_ChangeOutputDelay(owner, owner->delay);
+ if (owner->output_delay != 0)
+ Decoder_ChangeOutputDelay(owner, owner->output_delay);
}
/**
@@ -718,7 +718,7 @@ static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec )
p_dec->fmt_out.audio.i_frame_length =
p_owner->fmt.audio.i_frame_length;
- Decoder_UpdateOutState( p_owner );
+ Decoder_ReapplyOutState( p_owner );
vlc_fifo_Unlock( p_owner->p_fifo );
}
return 0;
@@ -812,11 +812,12 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
vlc_fifo_Lock(p_owner->p_fifo);
p_owner->video.started = true;
- Decoder_UpdateOutState( p_owner );
-
if (vout_state == INPUT_RESOURCE_VOUT_STARTED)
+ {
+ Decoder_ReapplyOutState( p_owner );
decoder_Notify(p_owner, on_vout_started, p_vout,
p_owner->video.vout_order);
+ }
vlc_fifo_Unlock(p_owner->p_fifo);
return 0;
}
@@ -1076,7 +1077,7 @@ static subpicture_t *ModuleThread_NewSpuBuffer( decoder_t *p_dec,
}
p_owner->spu.vout = p_vout;
- Decoder_UpdateOutState(p_owner);
+ Decoder_ReapplyOutState(p_owner);
assert(channel_order != VLC_VOUT_ORDER_NONE);
decoder_Notify(p_owner, on_vout_started, p_vout, channel_order);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b051dbefb0f997e6c9c120e0c93ecd20323067c6...8115e53bf0ad562722d14188f4aaf21ab3be4cac
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b051dbefb0f997e6c9c120e0c93ecd20323067c6...8115e53bf0ad562722d14188f4aaf21ab3be4cac
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