Skip to content

Commit

Permalink
Merge pull request #7 from cryptagon/upgrade-1.9.1
Browse files Browse the repository at this point in the history
Upgrade 1.9.3
  • Loading branch information
billylindeman authored Mar 5, 2021
2 parents c5940c9 + 128070d commit 40b75e5
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 20 deletions.
28 changes: 26 additions & 2 deletions cfgs/config-docker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,36 @@ httpaddr = ":7000"
key = ""
cert = ""

[signal.auth]
enabled = false
keytype = "HMAC"
key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS"

[sfu.sfu]
ballast = 1024
withstats = true

[sfu.router]
# Limit the remb bandwidth in kbps
# zero means no limits
maxbandwidth = 1500
# max buffer time by ms for video tracks
maxbuffertime = 1000
# max number of video tracks packets the SFU will keep track
maxpackettrack = 500
# Sets the audio level volume threshold.
# Values from [0-127] where 0 is the loudest.
# Audio levels are read from rtp extension header according to:
# https://tools.ietf.org/html/rfc6464
audiolevelthreshold = 40
# Sets the interval in which the SFU will check the audio level
# in [ms]. If the active speaker has changed, the sfu will
# emit an event to clients.
audiolevelinterval=1000
# Sets minimum percentage of events required to fire an audio level
# according to the expected events from the audiolevelinterval,
# calculated as audiolevelinterval/packetization time (20ms for 8kHz)
# Values from [0-100]
audiolevelfilter = 20


[sfu.router.simulcast]
# Prefer best quality initially
Expand Down
8 changes: 6 additions & 2 deletions cfgs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ enabled = false
keytype = "HMAC"
key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS"

[sfu.sfu]
ballast = 1024
withstats = true

[sfu.router]
# Limit the remb bandwidth in kbps
# zero means no limits
maxbandwidth = 1500
# max buffer time by ms for video tracks
maxbuffertime = 1000
# max number of video tracks packets the SFU will keep track
maxpackettrack = 500
# Sets the audio level volume threshold.
# Values from [0-127] where 0 is the loudest.
# Audio levels are read from rtp extension header according to:
Expand Down
23 changes: 21 additions & 2 deletions cfgs/config2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,31 @@ enabled = true
keytype = "HMAC"
key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS"

[sfu.sfu]
ballast = 1024
withstats = true

[sfu.router]
# Limit the remb bandwidth in kbps
# zero means no limits
maxbandwidth = 1500
# max buffer time by ms for video tracks
maxbuffertime = 1000
# max number of video tracks packets the SFU will keep track
maxpackettrack = 500
# Sets the audio level volume threshold.
# Values from [0-127] where 0 is the loudest.
# Audio levels are read from rtp extension header according to:
# https://tools.ietf.org/html/rfc6464
audiolevelthreshold = 40
# Sets the interval in which the SFU will check the audio level
# in [ms]. If the active speaker has changed, the sfu will
# emit an event to clients.
audiolevelinterval=1000
# Sets minimum percentage of events required to fire an audio level
# according to the expected events from the audiolevelinterval,
# calculated as audiolevelinterval/packetization time (20ms for 8kHz)
# Values from [0-100]
audiolevelfilter = 20


[sfu.router.simulcast]
# Prefer best quality initially
Expand Down
4 changes: 2 additions & 2 deletions cfgs/local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ withstats = true
# Limit the remb bandwidth in kbps
# zero means no limits
maxbandwidth = 1500
# max buffer time by ms for video tracks
maxbuffertime = 1000
# max number of video tracks packets the SFU will keep track
maxpackettrack = 500
# Sets the audio level volume threshold.
# Values from [0-127] where 0 is the loudest.
# Audio levels are read from rtp extension header according to:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/pborman/uuid v1.2.1
github.com/pion/interceptor v0.0.9
github.com/pion/ion-log v1.0.0
github.com/pion/ion-sfu v1.9.1-0.20210220020230-c52b1cd81c3a
github.com/pion/ion-sfu v1.9.3
github.com/pion/quic v0.1.4 // indirect
github.com/pion/sdp/v2 v2.4.0
github.com/pion/srtp v1.5.2 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ github.com/pion/ion-sfu v1.9.0 h1:3bgaTS1AyGvBmrU8R8nt/qQRguhOv3aGgaTEKUFAoUQ=
github.com/pion/ion-sfu v1.9.0/go.mod h1:MKDh4JSLpBA/hFeYAYALb6nYpe6Ruknd3pmxPMbdpM8=
github.com/pion/ion-sfu v1.9.1-0.20210220020230-c52b1cd81c3a h1:xSbhYqYknmm97himQ7o4gBL/2bmBKvBwGMBDsTqXBBM=
github.com/pion/ion-sfu v1.9.1-0.20210220020230-c52b1cd81c3a/go.mod h1:eRGTRVxYYvW7mhxcBByROYvZdm2aUqDSG499rje2Jh8=
github.com/pion/ion-sfu v1.9.1 h1:EqTLTw2j2DUKc5qw2l6tvUnDRaEZy899NjXkEEEjoC4=
github.com/pion/ion-sfu v1.9.1/go.mod h1:eRGTRVxYYvW7mhxcBByROYvZdm2aUqDSG499rje2Jh8=
github.com/pion/ion-sfu v1.9.3 h1:7p6He3bPIoJcgo+CaGA+ulOYvOSaYUxk9Yd06jrE+5o=
github.com/pion/ion-sfu v1.9.3/go.mod h1:eRGTRVxYYvW7mhxcBByROYvZdm2aUqDSG499rje2Jh8=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/mdns v0.0.4 h1:O4vvVqr4DGX63vzmO6Fw9vpy3lfztVWHGCQfyw0ZLSY=
Expand Down
26 changes: 16 additions & 10 deletions pkg/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/pborman/uuid"
log "github.com/pion/ion-log"
"github.com/pion/ion-sfu/pkg/buffer"
"github.com/pion/ion-sfu/pkg/middlewares/datachannel"
"github.com/pion/ion-sfu/pkg/sfu"
)
Expand Down Expand Up @@ -44,23 +45,28 @@ type localCoordinator struct {
nodeID string
nodeEndpoint string

mu sync.Mutex
w sfu.WebRTCTransportConfig
sessions map[string]*sfu.Session
datachannels []*sfu.Datachannel
mu sync.Mutex
w sfu.WebRTCTransportConfig
bufferFactory *buffer.Factory
sessions map[string]*sfu.Session
datachannels []*sfu.Datachannel
}

func newCoordinatorLocal(conf RootConfig) (coordinator, error) {
if conf.SFU.BufferFactory == nil {
conf.SFU.BufferFactory = buffer.NewBufferFactory(conf.SFU.Router.MaxPacketTrack)
}
w := sfu.NewWebRTCTransportConfig(conf.SFU)
dc := &sfu.Datachannel{Label: sfu.APIChannelLabel}
dc.Use(datachannel.SubscriberAPI)

return &localCoordinator{
nodeID: uuid.New(),
nodeEndpoint: conf.Endpoint(),
datachannels: []*sfu.Datachannel{dc},
sessions: make(map[string]*sfu.Session),
w: w,
nodeID: uuid.New(),
nodeEndpoint: conf.Endpoint(),
datachannels: []*sfu.Datachannel{dc},
sessions: make(map[string]*sfu.Session),
w: w,
bufferFactory: conf.SFU.BufferFactory,
}, nil
}

Expand All @@ -72,7 +78,7 @@ func (c *localCoordinator) ensureSession(sessionID string) *sfu.Session {
return s
}

s := sfu.NewSession(sessionID, c.datachannels, c.w)
s := sfu.NewSession(sessionID, c.bufferFactory, c.datachannels, c.w)
s.OnClose(func() {
c.onSessionClosed(sessionID)
})
Expand Down
9 changes: 8 additions & 1 deletion pkg/coordinator_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/pborman/uuid"
log "github.com/pion/ion-log"
"github.com/pion/ion-sfu/pkg/buffer"
"github.com/pion/ion-sfu/pkg/middlewares/datachannel"
"github.com/pion/ion-sfu/pkg/sfu"
"google.golang.org/grpc"
Expand All @@ -24,6 +25,7 @@ type etcdCoordinator struct {
client *clientv3.Client

w sfu.WebRTCTransportConfig
bufferFactory *buffer.Factory
datachannels []*sfu.Datachannel
localSessions map[string]*sfu.Session
sessionLeases map[string]context.CancelFunc
Expand All @@ -39,6 +41,10 @@ func newCoordinatorEtcd(conf RootConfig) (*etcdCoordinator, error) {
if err != nil {
return nil, err
}

if conf.SFU.BufferFactory == nil {
conf.SFU.BufferFactory = buffer.NewBufferFactory(conf.SFU.Router.MaxPacketTrack)
}
w := sfu.NewWebRTCTransportConfig(conf.SFU)
dc := &sfu.Datachannel{Label: sfu.APIChannelLabel}
dc.Use(datachannel.SubscriberAPI)
Expand All @@ -49,6 +55,7 @@ func newCoordinatorEtcd(conf RootConfig) (*etcdCoordinator, error) {
nodeID: uuid.New(),
nodeEndpoint: conf.Endpoint(),
w: w,
bufferFactory: conf.SFU.BufferFactory,
datachannels: []*sfu.Datachannel{dc},
sessionLeases: make(map[string]context.CancelFunc),
localSessions: make(map[string]*sfu.Session),
Expand Down Expand Up @@ -141,7 +148,7 @@ func (e *etcdCoordinator) ensureSession(sessionID string) *sfu.Session {
return s
}

s := sfu.NewSession(sessionID, e.datachannels, e.w)
s := sfu.NewSession(sessionID, e.bufferFactory, e.datachannels, e.w)
s.OnClose(func() {
e.onSessionClosed(sessionID)
})
Expand Down

0 comments on commit 40b75e5

Please sign in to comment.