From: qydysky Date: Mon, 9 Sep 2024 14:39:30 +0000 (+0800) Subject: Improve 挑选画质提示 X-Git-Tag: v0.14.18~3 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=63d1344e70150d9af306e44f660263cb406ad711;p=bili_danmu%2F.git Improve 挑选画质提示 --- 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 {