From 63d1344e70150d9af306e44f660263cb406ad711 Mon Sep 17 00:00:00 2001 From: qydysky Date: Mon, 9 Sep 2024 22:39:30 +0800 Subject: [PATCH] =?utf8?q?Improve=20=E6=8C=91=E9=80=89=E7=94=BB=E8=B4=A8?= =?utf8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- F/api.go | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/F/api.go b/F/api.go index e6ac3ee..8dd2962 100644 --- a/F/api.go +++ b/F/api.go @@ -662,26 +662,23 @@ func (t *GetFunc) getRoomPlayInfoByQn() (missKey []string) { return } - AcceptQn := []int{} - for k := range t.AcceptQn { - if k <= t.Live_want_qn { - AcceptQn = append(AcceptQn, k) + // 挑选最大的画质 + { + MaxQn := 0 + for k := range t.AcceptQn { + if k <= t.Live_want_qn && k > MaxQn { + MaxQn = k + } } - } - MaxQn := 0 - for i := 0; len(AcceptQn) > i; i += 1 { - if AcceptQn[i] > MaxQn { - MaxQn = AcceptQn[i] + if t.Live_want_qn != MaxQn { + apilog.L(`W: `, "期望清晰度不可用,使用", t.Qn[MaxQn]) } + t.Live_qn = MaxQn } - if MaxQn == 0 { - apilog.L(`W: `, "使用默认") - } - t.Live_qn = MaxQn //Roominitres { - if err, res := biliApi.GetRoomPlayInfo(t.Roomid, MaxQn); err != nil { + if err, res := biliApi.GetRoomPlayInfo(t.Roomid, t.Live_qn); err != nil { apilog.L(`E: `, err) return } else { -- 2.39.2