summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2021-03-08 09:46:18 +0100
committeravih <avih@users.noreply.github.com>2021-03-08 14:01:34 +0200
commit45e6804478c796c4f00fee26e1f152171effc241 (patch)
tree7c67023f2814c80859ee9af9e1841548262dde87
parentaac1844179194585d554b4dc24bd90ede3cb3a11 (diff)
downloadmpv-45e6804478c796c4f00fee26e1f152171effc241.tar.bz2
mpv-45e6804478c796c4f00fee26e1f152171effc241.tar.xz
ytdl_hook: fix crash on missing track bitrate
Some tracks happen to lack bitrate information (ie. no tbr value). In that case, just ignore the track while computing the max bitrate. For an example, this is a stream in which all audio tracks have no bitrate: https://www.raiplay.it/dirette/rai1
-rw-r--r--player/lua/ytdl_hook.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index e9a7b3aac7..586d4ea874 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -507,7 +507,7 @@ local function add_single_video(json)
if requested_formats then
for _, track in pairs(requested_formats) do
- max_bitrate = track.tbr > max_bitrate and
+ max_bitrate = (track.tbr and track.tbr > max_bitrate) and
track.tbr or max_bitrate
end
elseif json.tbr then