From 5a6fa242dd78eb09ce6ad8549be53b930c6ec772 Mon Sep 17 00:00:00 2001 From: nnwang <10577303+nnwang@user.noreply.gitee.com> Date: Sun, 22 Feb 2026 04:56:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- play.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/play.lua b/play.lua index 6d2efd1..d4d2bfa 100644 --- a/play.lua +++ b/play.lua @@ -188,10 +188,10 @@ end -- 分批下载(每批 50 帧) local BATCH_SIZE = 20 -- local totalFrames = #videoInfo.frame_urls -local totalFrames = videoInfo.fps * 20 -- 仅下载前10秒以节省时间 +local totalFrames = videoInfo.fps * 20 -- 仅下载前20秒以节省时间 local allFrameData = {} --- 第一步:构建所有需要下载的批次(仅前10秒) +-- 第一步:构建所有需要下载的批次(仅前20秒) local initBatches = {} for startIdx = 1, totalFrames, BATCH_SIZE do local endIdx = math.min(startIdx + BATCH_SIZE - 1, totalFrames) @@ -257,7 +257,7 @@ until _G.audio_ready local starttime1 = os.clock() --- 播放前已缓存 10 秒 +-- 播放前已缓存 20 秒 local totalFramesToPlay = #videoInfo.frame_urls -- 标志:是否还在播放 @@ -415,9 +415,10 @@ local function renderVideo() local data = allFrameData[frameIndex] - -- === 如果 data 存在才进行解码和渲染 === + -- === 如果 data 存在才进行解码和渲染 否则跳帧 === if data then -- 将字符串转换为字节表 + -- 感谢来自 https://center.mcmod.cn/1288558/ 提供高性能解码方案 local imgBin = { data:byte(1, #data) } data = nil