fix memory skill issue downloading m4a/aac

This commit is contained in:
Laptop
2026-01-29 22:34:16 +02:00
parent 655eb245c0
commit 404a043d7c
4 changed files with 14 additions and 13 deletions

View File

@@ -48,6 +48,7 @@ func Log(what ...any) {
var HlsClient *fasthttp.HostClient
var HlsStreamingOnlyClient *fasthttp.HostClient
var HlsAacClient *fasthttp.HostClient
var ImageStreamingOnlyClient *fasthttp.HostClient
func init() {
if cfg.Restream || cfg.ProxyStreams {
@@ -74,4 +75,15 @@ func init() {
DialDualStack: cfg.DialDualStack,
}
}
if cfg.Restream || cfg.ProxyImages {
ImageStreamingOnlyClient = &fasthttp.HostClient{
Addr: cfg.ImageCDN + ":443",
IsTLS: true,
MaxIdleConnDuration: cfg.MaxIdleConnDuration,
StreamResponseBody: true,
MaxResponseBodySize: 1,
DialDualStack: cfg.DialDualStack,
}
}
}

View File

@@ -9,7 +9,6 @@ import (
)
var al_httpc *fasthttp.HostClient
var streaming_httpc *fasthttp.HostClient
func Load(r *fiber.App) {
@@ -21,15 +20,6 @@ func Load(r *fiber.App) {
MaxResponseBodySize: 1,
}
streaming_httpc = &fasthttp.HostClient{
Addr: cfg.ImageCDN + ":443",
IsTLS: true,
MaxIdleConnDuration: cfg.MaxIdleConnDuration,
StreamResponseBody: true,
MaxResponseBodySize: 1,
DialDualStack: cfg.DialDualStack,
}
r.Get("/_/proxy/images", func(c fiber.Ctx) error {
url := c.RequestCtx().QueryArgs().Peek("url")
if len(url) == 0 {
@@ -52,7 +42,7 @@ func Load(r *fiber.App) {
var cl *fasthttp.HostClient
if parsed.Host()[0] == 'i' {
parsed.SetHost(cfg.ImageCDN)
cl = streaming_httpc
cl = misc.ImageStreamingOnlyClient
} else if string(parsed.Host()[:2]) == "al" {
cl = al_httpc
}

View File

@@ -399,7 +399,7 @@ func Load(r *fiber.App) {
if t.Artwork != "" {
r.req.SetRequestURI(t.Artwork)
err := sc.DoWithRetry(image_httpc, r.req, r.resp)
err := sc.DoWithRetry(misc.ImageStreamingOnlyClient, r.req, r.resp)
if err == nil && r.resp.StatusCode() == 200 {
parsed, _, err := image.Decode(r.resp.BodyStream())
r.resp.CloseBodyStream()

View File

@@ -692,7 +692,6 @@ Disallow: /`)
cfg.AudioOpus: true,
cfg.AudioMP3: true,
}
fmt.Println(t.Media.Transcodings)
for _, tr := range t.Media.Transcodings {
switch tr.Format.Protocol {
case sc.ProtocolHLS: