Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ytdl_hook: use the new max_request_size AVOption if needed #15612

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions player/lua/ytdl_hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,18 @@ local function add_single_video(json)
stream_opts["cookies"] = serialize_cookies_for_avformat(existing_cookies)
end

local chunk_size = math.huge
if has_requested_formats then
for _, f in pairs(requested_formats) do
if f.downloader_options and f.downloader_options.http_chunk_size then
chunk_size = math.min(chunk_size, tonumber(f.downloader_options.http_chunk_size))
end
end
end
if chunk_size < math.huge then
stream_opts = append_libav_opt(stream_opts, "max_request_size", tostring(chunk_size))
end

mp.set_property_native("file-local-options/stream-lavf-o", stream_opts)
end

Expand Down
Loading