summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
author138138138 <78271024+138138138@users.noreply.github.com>2022-06-23 02:13:22 +0800
committerGitHub <noreply@github.com>2022-06-23 02:13:22 +0800
commit140b6c1227754356145acd7b76820e3921745ef8 (patch)
tree5cc5aeba6a59c9a8de330c47a566a6f2acd5fced /src
parent6c73614a47a5a88df45aa32fadb64e85595d2a18 (diff)
downloadinvidious-140b6c1227754356145acd7b76820e3921745ef8.tar.gz
invidious-140b6c1227754356145acd7b76820e3921745ef8.tar.bz2
invidious-140b6c1227754356145acd7b76820e3921745ef8.zip
DASH playback force highest quality m4a
Since VideoJS is unable to handle adaptive audio quality, the best audo quality is forced for every video quality.
Diffstat (limited to 'src')
-rw-r--r--src/invidious/routes/api/manifest.cr11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr
index 8bc36946..8b5bfc06 100644
--- a/src/invidious/routes/api/manifest.cr
+++ b/src/invidious/routes/api/manifest.cr
@@ -61,7 +61,18 @@ module Invidious::Routes::API::Manifest
next if mime_streams.empty?
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do
+ # ignore the 64k m4a stream, only consider the 128k m4a stream
+ best_m4a_stream = mime_streams[0]
+ best_m4a_stream_bitrate = 0
mime_streams.each do |fmt|
+ bandwidth = fmt["bitrate"].as_i
+ if (bandwidth > best_m4a_stream_bitrate)
+ best_m4a_stream_bitrate = bandwidth
+ best_m4a_stream = fmt
+ end
+ end
+
+ [best_m4a_stream].each do |fmt|
# OTF streams aren't supported yet (See https://github.com/TeamNewPipe/NewPipe/issues/2415)
next if !(fmt.has_key?("indexRange") && fmt.has_key?("initRange"))