Added max queue length config entry
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c9111f8e8c
commit
5b766f3116
|
@ -15,6 +15,7 @@ type Config struct {
|
|||
BufferLengthInKiB int `toml:"buffer_len"`
|
||||
BufferSeconds int `toml:"buffer_size"`
|
||||
ReplayGain bool `toml:"replaygain"`
|
||||
Length int `toml:"length"`
|
||||
} `toml:"queue"`
|
||||
Radio struct {
|
||||
Port int `toml:"port"`
|
||||
|
|
4
queue.go
4
queue.go
|
@ -249,6 +249,10 @@ func (q *Queue) AddTrack(entry *QueueTrackEntry, tail bool) error {
|
|||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
|
||||
if q.config.Queue.Length > 0 && len(q.queue) >= q.config.Queue.Length {
|
||||
return errors.New("queue too long")
|
||||
}
|
||||
|
||||
source := entry.source
|
||||
if q.config.Queue.ReplayGain {
|
||||
if entry.Metadata.ReplayGain.TrackPeak != 0 {
|
||||
|
|
Loading…
Reference in a new issue