On a remote (URL/HTTP) source, opening the embedded-subtitle side-demuxer for a PGS/HDMV bitmap track blocks for the full analyzeCeiling (5.0 s) before it yields: such tracks never satisfy has_codec_parameters, so find_stream_info reads to the budget cap. When that open is on the startup path (host selectSubtitleTrack at load, or LoadOptions.preferredSubtitleLanguages auto-select), the 5 s lands as a flat pause before playback begins.
Root cause
Demuxer.swift, DemuxerOpenProfile.subtitleSideDemuxer:
let probeCeiling: Int64 = 4 * 1024 * 1024 // 4 MB
let analyzeCeiling: Int64 = 5 * 1_000_000 // 5.0 s
The profile's own doc comment already describes it: PGS streams "keep has_codec_parameters false to the budget cap (the #75 pattern)," so find_stream_info runs to the full ceiling. A fast LAN hides it; a slower/remote URL blocks ~5 s. Since EmbeddedSubtitleDecoder only needs codec_id / codec_type (resolved by avformat_open_input from the container header / MPEG-TS PMT) and seeds the bitmap canvas from the source video size, the find_stream_info chase is pure cost.
Repro
A 1080p/4K HEVC file with embedded PGS (HDMV bitmap) subtitle tracks served over an HTTP/URL source (custom AVIO); select that PGS track at load. Result: ~5 s paused before playback self-starts. The same open is instant on a local file.
Suggested fix direction
Cap the subtitle side-demuxer's analyzeCeiling to sub-second (codec params come from the header/PMT before find_stream_info), or skip find_stream_info for the side-demuxer and read codec_type / codec_id directly, or make the open non-blocking with respect to the startup gate. Related: #52, #75, #76.
Host-side note: integrators can mitigate by deferring selectSubtitleTrack past the first playing state, but the 5 s budget is unnecessary regardless.
On a remote (URL/HTTP) source, opening the embedded-subtitle side-demuxer for a PGS/HDMV bitmap track blocks for the full
analyzeCeiling(5.0 s) before it yields: such tracks never satisfyhas_codec_parameters, sofind_stream_inforeads to the budget cap. When that open is on the startup path (hostselectSubtitleTrackat load, orLoadOptions.preferredSubtitleLanguagesauto-select), the 5 s lands as a flat pause before playback begins.Root cause
Demuxer.swift,DemuxerOpenProfile.subtitleSideDemuxer:The profile's own doc comment already describes it: PGS streams "keep
has_codec_parametersfalse to the budget cap (the #75 pattern)," sofind_stream_inforuns to the full ceiling. A fast LAN hides it; a slower/remote URL blocks ~5 s. SinceEmbeddedSubtitleDecoderonly needscodec_id/codec_type(resolved byavformat_open_inputfrom the container header / MPEG-TS PMT) and seeds the bitmap canvas from the source video size, thefind_stream_infochase is pure cost.Repro
A 1080p/4K HEVC file with embedded PGS (HDMV bitmap) subtitle tracks served over an HTTP/URL source (custom AVIO); select that PGS track at load. Result: ~5 s paused before playback self-starts. The same open is instant on a local file.
Suggested fix direction
Cap the subtitle side-demuxer's
analyzeCeilingto sub-second (codec params come from the header/PMT beforefind_stream_info), or skipfind_stream_infofor the side-demuxer and readcodec_type/codec_iddirectly, or make the open non-blocking with respect to the startup gate. Related: #52, #75, #76.Host-side note: integrators can mitigate by deferring
selectSubtitleTrackpast the first playing state, but the 5 s budget is unnecessary regardless.