Skip to content

Commit c26bee6

Browse files
authored
Update latencies, log track stats (#379)
* update latencies, log track stats * update sdk ref * fix track stats
1 parent 985875e commit c26bee6

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
2222
github.com/livekit/protocol v1.5.8-0.20230601212100-a186ecb11a98
2323
github.com/livekit/psrpc v0.3.0
24-
github.com/livekit/server-sdk-go v1.0.11-0.20230601141132-d050553cfc5e
24+
github.com/livekit/server-sdk-go v1.0.11-0.20230603013535-cd2ade940f03
2525
github.com/pion/rtp v1.7.13
2626
github.com/pion/webrtc/v3 v3.2.8
2727
github.com/prometheus/client_golang v1.15.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ github.com/livekit/protocol v1.5.8-0.20230601212100-a186ecb11a98 h1:OkQu5+sAgOzL
179179
github.com/livekit/protocol v1.5.8-0.20230601212100-a186ecb11a98/go.mod h1:ZaOnsvP+JS4s7vI1UO+JVdBagvvLp/lBXDAl2hkDS0I=
180180
github.com/livekit/psrpc v0.3.0 h1:giBZsfM3CWA0oIYXofsMITbVQtyW7u/ES9sQmVspHPM=
181181
github.com/livekit/psrpc v0.3.0/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
182-
github.com/livekit/server-sdk-go v1.0.11-0.20230601141132-d050553cfc5e h1:82QDZydt0ZR6zIQIPs8JmouDdjto5Dj9nzKjQ1PR3CU=
183-
github.com/livekit/server-sdk-go v1.0.11-0.20230601141132-d050553cfc5e/go.mod h1:8TeHbaUbm5ylUJ0OthbVNH4HIG2nTGFF9Ucr7zX99aM=
182+
github.com/livekit/server-sdk-go v1.0.11-0.20230603013535-cd2ade940f03 h1:/CJCedRin9wfM1gUjN7y6HbVREoW+DXB6qbmai5/bpo=
183+
github.com/livekit/server-sdk-go v1.0.11-0.20230603013535-cd2ade940f03/go.mod h1:8TeHbaUbm5ylUJ0OthbVNH4HIG2nTGFF9Ucr7zX99aM=
184184
github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs=
185185
github.com/mackerelio/go-osstat v0.2.4/go.mod h1:Zy+qzGdZs3A9cuIqmgbJvwbmLQH9dJvtio5ZjJTbdlQ=
186186
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=

pkg/config/pipeline.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
)
2121

2222
const (
23-
webLatency = uint64(15e8)
24-
sdkLatency = uint64(43e8)
23+
webLatency = uint64(2e9)
24+
sdkLatency = uint64(3e9)
2525
)
2626

2727
type PipelineConfig struct {

pkg/pipeline/input/audio.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/livekit/egress/pkg/types"
1313
)
1414

15-
const audioMixerLatency = uint64(41e8)
15+
const audioMixerLatency = uint64(2e9)
1616

1717
type AudioInput struct {
1818
decoder []*gst.Element

pkg/pipeline/output/stream.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (b *Bin) buildStreamOutput(p *config.PipelineConfig) (*StreamOutput, error)
3333
return nil, errors.ErrGstPipelineError(err)
3434
}
3535

36-
mux, err := buildStreamMux(o)
36+
mux, err := buildStreamMux(p, o)
3737
if err != nil {
3838
return nil, err
3939
}
@@ -74,7 +74,7 @@ func (b *Bin) buildStreamOutput(p *config.PipelineConfig) (*StreamOutput, error)
7474
}, nil
7575
}
7676

77-
func buildStreamMux(o *config.StreamConfig) (*gst.Element, error) {
77+
func buildStreamMux(p *config.PipelineConfig, o *config.StreamConfig) (*gst.Element, error) {
7878
switch o.OutputType {
7979
case types.OutputTypeRTMP:
8080
mux, err := gst.NewElement("flvmux")
@@ -85,7 +85,7 @@ func buildStreamMux(o *config.StreamConfig) (*gst.Element, error) {
8585
return nil, errors.ErrGstPipelineError(err)
8686
}
8787
// add latency to give time for flvmux to receive and order packets from both streams
88-
if err = mux.SetProperty("latency", uint64(2e8)); err != nil {
88+
if err = mux.SetProperty("latency", p.Latency); err != nil {
8989
return nil, errors.ErrGstPipelineError(err)
9090
}
9191

pkg/pipeline/source/sdk.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,13 @@ func (s *SDKSource) CloseWriters() {
106106
go func() {
107107
defer wg.Done()
108108
s.audioWriter.Drain(false)
109-
logger.Debugw("audio writer finished")
110109
}()
111110
}
112111
if s.videoWriter != nil {
113112
wg.Add(1)
114113
go func() {
115114
defer wg.Done()
116115
s.videoWriter.Drain(false)
117-
logger.Debugw("video writer finished")
118116
}()
119117
}
120118
wg.Wait()

pkg/pipeline/source/sdk/appwriter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ func (w *AppWriter) run() {
174174
w.logger.Errorw("unexpected flow return", nil, "flowReturn", flow.String())
175175
}
176176
}
177+
stats := w.TrackSynchronizer.GetTrackStats()
178+
w.logger.Infow("writer finished",
179+
"avg sample duration", stats.AvgSampleDuration,
180+
"avg drift", stats.AvgDrift,
181+
"max drift", stats.MaxDrift,
182+
)
177183
w.finished.Break()
178184
}
179185

0 commit comments

Comments
 (0)