command: don't run UPDATE_{AD,VD} if the {ao,vo}_chain doesn't exist

As described in 544240c829, the callbacks
are all run on init so UPDATE_AD and UPDATE_VD both executed. While this
is probably not harmful, it is completely pointless work and results in
extra event notifications being sent. Just skip these if there is no
matching chain.
This commit is contained in:
Dudemanguy
2025-01-28 16:55:25 -06:00
parent 8c4ca44e24
commit 694817121a

View File

@@ -7748,12 +7748,12 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
if (flags & UPDATE_DEMUXER)
mpctx->demuxer_changed = true;
if (flags & UPDATE_AD) {
if (flags & UPDATE_AD && mpctx->ao_chain) {
uninit_audio_chain(mpctx);
reinit_audio_chain(mpctx);
}
if (flags & UPDATE_VD) {
if (flags & UPDATE_VD && mpctx->vo_chain) {
struct track *track = mpctx->current_track[0][STREAM_VIDEO];
uninit_video_chain(mpctx);
reinit_video_chain(mpctx);