sub/lavc_conv: prevent corruption after switching WebM WebVTT subs

WebVTT subtitles in WebM require special logic, and we signal that using
the "webvtt-webm" codec name, which is not part of FFmpeg. That worked
fine until commit 94859997b8 ("sub: update codec info") added a call
to mp_codec_info_from_av(), which overwrites our codec name with
FFmpeg's the first time the subtitle decoder is initialized. As a
result, WebM WebVTT subtitles are currently not rendered correctly after
switching subtitle tracks. Fix the issue by resetting the codec name
after calling mp_codec_info_from_av().
This commit is contained in:
Thomas Hebb
2025-07-14 01:26:43 -04:00
committed by Dudemanguy
parent 6c720f0f49
commit 036fae317c
+2
View File
@@ -104,6 +104,8 @@ struct lavc_conv *lavc_conv_create(struct sd *sd)
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
avctx->subtitle_header_size);
mp_codec_info_from_av(avctx, sd->codec);
// Keep original codec name, which get_lavc_format() may have transformed
sd->codec->codec = priv->codec;
return priv;
error: