mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
fix: default EnableWebPEncoding to false and reduce artwork parallelism
Changed EnableWebPEncoding default to false so that upgrading users get the same JPEG/PNG encoding behavior as v0.60.3 out of the box, avoiding the WebP WASM overhead until native libwebp is available. Users can opt in to WebP by setting EnableWebPEncoding=true. Also reduced the default DevArtworkMaxRequests to half the CPU count (min 2) to lower resource pressure during artwork processing.
This commit is contained in:
parent
a31ce7ffa3
commit
75d0c839c3
@ -724,7 +724,7 @@ func setViperDefaults() {
|
|||||||
viper.SetDefault("mpvcmdtemplate", "mpv --audio-device=%d --no-audio-display %f --input-ipc-server=%s")
|
viper.SetDefault("mpvcmdtemplate", "mpv --audio-device=%d --no-audio-display %f --input-ipc-server=%s")
|
||||||
viper.SetDefault("coverartpriority", "cover.*, folder.*, front.*, embedded, external")
|
viper.SetDefault("coverartpriority", "cover.*, folder.*, front.*, embedded, external")
|
||||||
viper.SetDefault("coverartquality", 75)
|
viper.SetDefault("coverartquality", 75)
|
||||||
viper.SetDefault("enablewebpencoding", true)
|
viper.SetDefault("enablewebpencoding", false)
|
||||||
viper.SetDefault("artistartpriority", "artist.*, album/artist.*, external")
|
viper.SetDefault("artistartpriority", "artist.*, album/artist.*, external")
|
||||||
viper.SetDefault("artistimagefolder", "")
|
viper.SetDefault("artistimagefolder", "")
|
||||||
viper.SetDefault("discartpriority", "disc*.*, cd*.*, cover.*, folder.*, front.*, discsubtitle, embedded")
|
viper.SetDefault("discartpriority", "disc*.*, cd*.*, cover.*, folder.*, front.*, discsubtitle, embedded")
|
||||||
@ -820,7 +820,7 @@ func setViperDefaults() {
|
|||||||
viper.SetDefault("devuishowconfig", true)
|
viper.SetDefault("devuishowconfig", true)
|
||||||
viper.SetDefault("devneweventstream", true)
|
viper.SetDefault("devneweventstream", true)
|
||||||
viper.SetDefault("devoffsetoptimize", 50000)
|
viper.SetDefault("devoffsetoptimize", 50000)
|
||||||
viper.SetDefault("devartworkmaxrequests", max(4, runtime.NumCPU()))
|
viper.SetDefault("devartworkmaxrequests", max(2, runtime.NumCPU()/2))
|
||||||
viper.SetDefault("devartworkthrottlebackloglimit", consts.RequestThrottleBacklogLimit)
|
viper.SetDefault("devartworkthrottlebackloglimit", consts.RequestThrottleBacklogLimit)
|
||||||
viper.SetDefault("devartworkthrottlebacklogtimeout", consts.RequestThrottleBacklogTimeout)
|
viper.SetDefault("devartworkthrottlebacklogtimeout", consts.RequestThrottleBacklogTimeout)
|
||||||
viper.SetDefault("devartistinfotimetolive", consts.ArtistInfoTimeToLive)
|
viper.SetDefault("devartistinfotimetolive", consts.ArtistInfoTimeToLive)
|
||||||
|
|||||||
@ -380,24 +380,24 @@ var _ = Describe("Artwork", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
When("Square is false", func() {
|
When("Square is false", func() {
|
||||||
It("returns WebP even if original image is a PNG", func() {
|
It("returns PNG if original image is a PNG", func() {
|
||||||
conf.Server.CoverArtPriority = "front.png"
|
conf.Server.CoverArtPriority = "front.png"
|
||||||
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 15, false)
|
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 15, false)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
img, format, err := image.Decode(r)
|
img, format, err := image.Decode(r)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(format).To(Equal("webp"))
|
Expect(format).To(Equal("png"))
|
||||||
Expect(img.Bounds().Size().X).To(Equal(15))
|
Expect(img.Bounds().Size().X).To(Equal(15))
|
||||||
Expect(img.Bounds().Size().Y).To(Equal(15))
|
Expect(img.Bounds().Size().Y).To(Equal(15))
|
||||||
})
|
})
|
||||||
It("returns WebP if original image is not a PNG", func() {
|
It("returns JPEG if original image is not a PNG", func() {
|
||||||
conf.Server.CoverArtPriority = "cover.jpg"
|
conf.Server.CoverArtPriority = "cover.jpg"
|
||||||
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 200, false)
|
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 200, false)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
img, format, err := image.Decode(r)
|
img, format, err := image.Decode(r)
|
||||||
Expect(format).To(Equal("webp"))
|
Expect(format).To(Equal("jpeg"))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(img.Bounds().Size().X).To(Equal(200))
|
Expect(img.Bounds().Size().X).To(Equal(200))
|
||||||
Expect(img.Bounds().Size().Y).To(Equal(200))
|
Expect(img.Bounds().Size().Y).To(Equal(200))
|
||||||
@ -430,12 +430,39 @@ var _ = Describe("Artwork", func() {
|
|||||||
Expect(img.Bounds().Size().X).To(Equal(size))
|
Expect(img.Bounds().Size().X).To(Equal(size))
|
||||||
Expect(img.Bounds().Size().Y).To(Equal(size))
|
Expect(img.Bounds().Size().Y).To(Equal(size))
|
||||||
},
|
},
|
||||||
Entry("portrait png image", "png", "webp", false, 200),
|
Entry("portrait png image", "png", "png", false, 200),
|
||||||
Entry("landscape png image", "png", "webp", true, 200),
|
Entry("landscape png image", "png", "png", true, 200),
|
||||||
Entry("portrait jpg image", "jpg", "webp", false, 200),
|
Entry("portrait jpg image", "jpg", "png", false, 200),
|
||||||
Entry("landscape jpg image", "jpg", "webp", true, 200),
|
Entry("landscape jpg image", "jpg", "png", true, 200),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
When("EnableWebPEncoding is true and square is false", func() {
|
||||||
|
BeforeEach(func() {
|
||||||
|
conf.Server.EnableWebPEncoding = true
|
||||||
|
})
|
||||||
|
It("returns WebP even if original image is a PNG", func() {
|
||||||
|
conf.Server.CoverArtPriority = "front.png"
|
||||||
|
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 15, false)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
img, format, err := image.Decode(r)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(format).To(Equal("webp"))
|
||||||
|
Expect(img.Bounds().Size().X).To(Equal(15))
|
||||||
|
Expect(img.Bounds().Size().Y).To(Equal(15))
|
||||||
|
})
|
||||||
|
It("returns WebP if original image is not a PNG", func() {
|
||||||
|
conf.Server.CoverArtPriority = "cover.jpg"
|
||||||
|
r, _, err := aw.Get(context.Background(), alMultipleCovers.CoverArtID(), 200, false)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
img, format, err := image.Decode(r)
|
||||||
|
Expect(format).To(Equal("webp"))
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(img.Bounds().Size().X).To(Equal(200))
|
||||||
|
Expect(img.Bounds().Size().Y).To(Equal(200))
|
||||||
|
})
|
||||||
|
})
|
||||||
When("EnableWebPEncoding is false and square is false", func() {
|
When("EnableWebPEncoding is false and square is false", func() {
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
conf.Server.EnableWebPEncoding = false
|
conf.Server.EnableWebPEncoding = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user