修改注释
This commit is contained in:
9
play.lua
9
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user