mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-02 06:23:37 +02:00
fix(session): allow providers without default URL
This commit is contained in:
@@ -153,7 +153,13 @@ func RegisterDefaults() {
|
||||
|
||||
// ApplyAuthDefaults fills in Engine and URL from the auth provider when they are not set explicitly.
|
||||
// For -auth none the fields are left untouched (the caller supplies them directly).
|
||||
// Returns an error if the auth provider has no default URL and -url was not given.
|
||||
//
|
||||
// An empty cfg.URL is acceptable when the auth provider does not advertise a
|
||||
// DefaultServiceURL — those providers (e.g. jitsi) extract the SFU host from
|
||||
// the user-supplied RoomURL inside Issue(), so an externally fixed
|
||||
// service URL would be meaningless. Providers that DO advertise a
|
||||
// DefaultServiceURL (telemost, wbstream, jazz) still require URL to be set
|
||||
// when their default cannot be applied.
|
||||
func ApplyAuthDefaults(cfg Config) (Config, error) {
|
||||
if cfg.Auth == authNone || cfg.Auth == "" {
|
||||
return cfg, nil
|
||||
@@ -168,7 +174,7 @@ func ApplyAuthDefaults(cfg Config) (Config, error) {
|
||||
if cfg.URL == "" {
|
||||
cfg.URL = p.DefaultServiceURL()
|
||||
}
|
||||
if cfg.URL == "" {
|
||||
if cfg.URL == "" && p.DefaultServiceURL() != "" {
|
||||
return cfg, fmt.Errorf("%w: auth provider %q has no default URL", ErrURLRequired, cfg.Auth)
|
||||
}
|
||||
return cfg, nil
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/openlibrecommunity/olcrtc/internal/engine"
|
||||
"github.com/openlibrecommunity/olcrtc/internal/logger"
|
||||
pioninterceptor "github.com/pion/interceptor"
|
||||
"github.com/pion/webrtc/v4"
|
||||
"github.com/zarazaex69/j"
|
||||
)
|
||||
@@ -238,7 +239,20 @@ func (s *Session) videoTrackHandler() func(*webrtc.TrackRemote, *webrtc.RTPRecei
|
||||
func (s *Session) negotiatePC(ctx context.Context, jSess *j.Session) error {
|
||||
settings := webrtc.SettingEngine{}
|
||||
settings.LoggerFactory = logger.NewPionLoggerFactory()
|
||||
api := webrtc.NewAPI(webrtc.WithSettingEngine(settings))
|
||||
|
||||
// pion auto-registers a default interceptor chain (sender reports,
|
||||
// receiver reports, NACK, etc.) when none is supplied. Several of
|
||||
// those probe the DTLS transport on a tick — until DTLS comes up
|
||||
// (which can take seconds against Jitsi's STUN-only path, or never
|
||||
// in pathological cases) they spam logs with
|
||||
// "the DTLS transport has not started yet". JVB performs its own
|
||||
// RTCP feedback aggregation, so the conference PC does not need
|
||||
// any of those interceptors. An empty registry silences the noise.
|
||||
registry := &pioninterceptor.Registry{}
|
||||
api := webrtc.NewAPI(
|
||||
webrtc.WithSettingEngine(settings),
|
||||
webrtc.WithInterceptorRegistry(registry),
|
||||
)
|
||||
|
||||
// Jicofo emits Plan B style SDP with separate <content> sections per
|
||||
// media kind and SSRC-keyed source descriptors. pion's default
|
||||
|
||||
Reference in New Issue
Block a user