Update error msg for fail codecs negotiation

This commit is contained in:
Alexey Khit
2022-12-05 23:52:28 +03:00
parent b965c191b7
commit 5b39f78ace
+6 -1
View File
@@ -3,6 +3,7 @@ package streams
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"github.com/AlexxIT/go2rtc/pkg/streamer" "github.com/AlexxIT/go2rtc/pkg/streamer"
"strings" "strings"
"sync" "sync"
@@ -98,7 +99,11 @@ func (s *Stream) AddConsumer(cons streamer.Consumer) (err error) {
if len(producers) == 0 { if len(producers) == 0 {
s.stopProducers() s.stopProducers()
return errors.New("no matching codecs: " + codecs) if len(codecs) > 0 {
return errors.New("codecs not match: " + codecs)
} else {
return fmt.Errorf("sources unavailable: %d", len(s.producers))
}
} }
s.mu.Lock() s.mu.Lock()