From 84835e26e022af4ec28621fa1d67e6275c2eb674 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 15 Oct 2023 12:58:42 -0400 Subject: [PATCH] dash manifest sorting --- .../components/Services/Dash/DashManifest.bs | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/playlet-lib/src/components/Services/Dash/DashManifest.bs b/playlet-lib/src/components/Services/Dash/DashManifest.bs index 67ccf715..bd1d4532 100644 --- a/playlet-lib/src/components/Services/Dash/DashManifest.bs +++ b/playlet-lib/src/components/Services/Dash/DashManifest.bs @@ -270,7 +270,19 @@ class DashManifest audioStreams = [] for i = 0 to streams.Count() - 1 stream = streams[i] - if stream.type.startsWith("audio/") and stream.bitrate <> invalid and stream.init <> invalid and stream.index <> invalid + if stream.type.startsWith("audio/") + if stream.bitrate = invalid + LogWarn("Invalid audio stream bitrate, itag:", stream.itag) + continue for + end if + if stream.init = invalid + LogWarn("Invalid audio stream init, itag:", stream.itag) + continue for + end if + if stream.index = invalid + LogWarn("Invalid audio stream index, itag:", stream.itag) + continue for + end if stream.languageInfo = m.ParseAudioLanguage(stream.url) audioStreams.Push(stream) end if @@ -284,12 +296,24 @@ class DashManifest videoStreams = [] for i = 0 to streams.Count() - 1 stream = streams[i] - if stream.type.startsWith("video/") and stream.init <> invalid and stream.index <> invalid + if stream.type.startsWith("video/") + if stream.bitrate = invalid + LogWarn("Invalid video stream bitrate, itag:", stream.itag) + continue for + end if + if stream.init = invalid + LogWarn("Invalid video stream init, itag:", stream.itag) + continue for + end if + if stream.index = invalid + LogWarn("Invalid video stream index, itag:", stream.itag) + continue for + end if videoStreams.Push(stream) end if end for - videoStreams.SortBy("width", "r") + videoStreams.SortBy("bitrate", "r") return videoStreams end function