mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 16:54:46 +03:00
Enforce more strict webm check
The webm spec only supports video and video streams, and other type of streams in the container should disqualify its webm container type and be treated as mkv. Some tools might allow users to add subtitle streams to webm and still claim it is webm, but such files are not guranteed to play directly everywhere, and the actuall support is implementation specific. With the advent of the (unreliable) native mkv support in firefox, this will be required to properly trigger remux for such files.
This commit is contained in:
@@ -299,9 +299,12 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
// Handle WebM
|
||||
else if (string.Equals(splitFormat[i], "webm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Limit WebM to supported codecs
|
||||
if (mediaStreams.Any(stream => (stream.Type == MediaStreamType.Video && !_webmVideoCodecs.Contains(stream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||
|| (stream.Type == MediaStreamType.Audio && !_webmAudioCodecs.Contains(stream.Codec, StringComparison.OrdinalIgnoreCase))))
|
||||
// Limit WebM to supported stream types and codecs.
|
||||
// FFprobe can report "matroska,webm" for Matroska-like containers, so only keep "webm" if all streams are WebM-compatible.
|
||||
// Any stream that is not video nor audio is not supported in WebM and should disqualify the webm container probe result.
|
||||
if (mediaStreams.Any(stream => stream.Type is not MediaStreamType.Video and not MediaStreamType.Audio)
|
||||
|| mediaStreams.Any(stream => (stream.Type == MediaStreamType.Video && !_webmVideoCodecs.Contains(stream.Codec, StringComparison.OrdinalIgnoreCase))
|
||||
|| (stream.Type == MediaStreamType.Audio && !_webmAudioCodecs.Contains(stream.Codec, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
splitFormat[i] = string.Empty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user