Skip to content

🎧 Your Personal Streaming Service

refactor(transcoding): rename EnableTranscodingCancellation to Transcoding.EnableCancellation (#5523)

Deluan Quintão823d851b75f7
diff --git a/conf/configuration.go b/conf/configuration.go
index b4c43f135..08f12fc94 100644
--- a/conf/configuration.go
+++ b/conf/configuration.go
@@ -47,7 +47,6 @@ type configOptions struct {
UIWelcomeMessage string
MaxSidebarPlaylists int
EnableTranscodingConfig bool
- EnableTranscodingCancellation bool
EnableDownloads bool
EnableExternalServices bool
EnableM3UExternalAlbumArt bool
@@ -169,6 +168,7 @@ type scannerOptions struct {
type transcodingOptions struct {
MaxConcurrent int
MaxConcurrentPerUser int
+ EnableCancellation bool
}
type subsonicOptions struct {
@@ -330,6 +330,7 @@ func Load(noConfigDump bool) {
mapDeprecatedOption("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
mapDeprecatedOption("CoverJpegQuality", "CoverArtQuality")
mapDeprecatedOption("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
+ mapDeprecatedOption("EnableTranscodingCancellation", "Transcoding.EnableCancellation")
err := viper.Unmarshal(&Server, viper.DecodeHook(
mapstructure.ComposeDecodeHookFunc(
@@ -455,6 +456,7 @@ func Load(noConfigDump bool) {
logDeprecatedOptions("HTTPSecurityHeaders.CustomFrameOptionsValue", "HTTPHeaders.FrameOptions")
logDeprecatedOptions("CoverJpegQuality", "CoverArtQuality")
logDeprecatedOptions("SimilarSongsMatchThreshold", "Matcher.FuzzyThreshold")
+ logDeprecatedOptions("EnableTranscodingCancellation", "Transcoding.EnableCancellation")
// Removed options
logRemovedOptions("Spotify.ID", "Spotify.Secret")
@@ -743,7 +745,6 @@ func setViperDefaults() {
viper.SetDefault("uiwelcomemessage", "")
viper.SetDefault("maxsidebarplaylists", consts.DefaultMaxSidebarPlaylists)
viper.SetDefault("enabletranscodingconfig", false)
- viper.SetDefault("enabletranscodingcancellation", false)
viper.SetDefault("transcodingcachesize", "100MB")
viper.SetDefault("imagecachesize", "100MB")
viper.SetDefault("albumplaycountmode", consts.AlbumPlayCountModeAbsolute)
@@ -830,6 +831,7 @@ func setViperDefaults() {
viper.SetDefault("subsonic.minimalclients", "SubMusic")
viper.SetDefault("transcoding.maxconcurrent", 0)
viper.SetDefault("transcoding.maxconcurrentperuser", 0)
+ viper.SetDefault("transcoding.enablecancellation", false)
viper.SetDefault("agents", "deezer,lastfm,listenbrainz")
viper.SetDefault("lastfm.enabled", true)
viper.SetDefault("lastfm.language", consts.DefaultInfoLanguage)
diff --git a/core/stream/media_streamer.go b/core/stream/media_streamer.go
index f898e066e..b09d9bab8 100644
--- a/core/stream/media_streamer.go
+++ b/core/stream/media_streamer.go
@@ -248,10 +248,10 @@ func NewTranscodingCache() TranscodingCache {
// the DoS the limiter is meant to prevent.
//
// When the limiter is disabled, preserve the legacy behavior
- // governed by EnableTranscodingCancellation so this PR does not
- // change observable behavior for operators who have not opted in.
+ // governed by Transcoding.EnableCancellation so unchanged configs
+ // keep their previous observable behavior.
var transcodingCtx context.Context
- if job.ms.limiter.Enabled() || conf.Server.EnableTranscodingCancellation {
+ if job.ms.limiter.Enabled() || conf.Server.Transcoding.EnableCancellation {
transcodingCtx = ctx
} else {
transcodingCtx = request.AddValues(context.Background(), ctx)