spdif: Consider spdif enabled if aplay is still running

This commit is contained in:
nemunaire 2023-11-27 13:01:48 +01:00
parent 4891d5f7b7
commit e224b6a986

View File

@ -52,7 +52,7 @@ func (s *SPDIFSource) IsActive() bool {
} }
func (s *SPDIFSource) IsEnabled() bool { func (s *SPDIFSource) IsEnabled() bool {
return s.processRec != nil return s.processRec != nil || s.processPlay != nil
} }
func (s *SPDIFSource) Enable() error { func (s *SPDIFSource) Enable() error {
@ -80,9 +80,8 @@ func (s *SPDIFSource) Enable() error {
if s.processPlay != nil && s.processPlay.Process != nil { if s.processPlay != nil && s.processPlay.Process != nil {
s.processPlay.Process.Kill() s.processPlay.Process.Kill()
} }
pipeR.Close()
pipeW.Close()
} }
pipeR.Close()
s.processPlay = nil s.processPlay = nil
}() }()
@ -99,6 +98,7 @@ func (s *SPDIFSource) Enable() error {
if err != nil { if err != nil {
s.processRec.Process.Kill() s.processRec.Process.Kill()
} }
pipeW.Close()
s.processRec = nil s.processRec = nil
}() }()