diff --git a/go.mod b/go.mod index a569871a..f6e99cae 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,6 @@ module github.com/livekit/egress go 1.20 -replace github.com/tinyzimmer/go-glib v0.0.25 => github.com/livekit/go-glib v0.0.0-20230223001336-834490045522 - -replace github.com/tinyzimmer/go-gst v0.2.33 => github.com/livekit/go-gst v0.2.34-0.20230901155409-dd09095b979e - require ( cloud.google.com/go/storage v1.31.0 github.com/Azure/azure-storage-blob-go v0.15.0 @@ -14,6 +10,8 @@ require ( github.com/chromedp/cdproto v0.0.0-20230625224106-7fafe342e117 github.com/chromedp/chromedp v0.9.1 github.com/frostbyte73/core v0.0.9 + github.com/go-gst/go-glib v0.0.0-20230906175327-b2d34240bcb4 + github.com/go-gst/go-gst v0.0.0-20231009181223-aa872b0f6c0c github.com/go-logr/logr v1.2.4 github.com/googleapis/gax-go/v2 v2.12.0 github.com/gorilla/websocket v1.5.0 @@ -27,8 +25,6 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.8.4 - github.com/tinyzimmer/go-glib v0.0.25 - github.com/tinyzimmer/go-gst v0.2.33 github.com/urfave/cli/v2 v2.25.7 go.uber.org/atomic v1.11.0 go.uber.org/zap v1.26.0 diff --git a/go.sum b/go.sum index fb73d211..50b97a7d 100644 --- a/go.sum +++ b/go.sum @@ -83,6 +83,10 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4 github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0= github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gst/go-glib v0.0.0-20230906175327-b2d34240bcb4 h1:c2y2vC6HUoWfFsnTaR+D80d1pNsvA5uqd2yHAs+emDU= +github.com/go-gst/go-glib v0.0.0-20230906175327-b2d34240bcb4/go.mod h1:rXuKU+tCN7pN+b/7oIyWv6MpnlGy+QWd7jRhWUNstjU= +github.com/go-gst/go-gst v0.0.0-20231009181223-aa872b0f6c0c h1:tnXVeRaPX/g10eWPqoCN46oxRcXvB2AkTBKcaxOALvA= +github.com/go-gst/go-gst v0.0.0-20231009181223-aa872b0f6c0c/go.mod h1:yPBGJ0tPALScq484ccEfiSom85fK+ccSZjY+Ua1cHi8= github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -164,10 +168,6 @@ github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 h1:6Yzfa6GP0rIo/kUL github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= github.com/lithammer/shortuuid/v4 v4.0.0 h1:QRbbVkfgNippHOS8PXDkti4NaWeyYfcBTHtw7k08o4c= github.com/lithammer/shortuuid/v4 v4.0.0/go.mod h1:Zs8puNcrvf2rV9rTH51ZLLcj7ZXqQI3lv67aw4KiB1Y= -github.com/livekit/go-glib v0.0.0-20230223001336-834490045522 h1:AlU57PAPgzde7q9u6iFU+gyPhwWFUmyFCdzonBif4f4= -github.com/livekit/go-glib v0.0.0-20230223001336-834490045522/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM= -github.com/livekit/go-gst v0.2.34-0.20230901155409-dd09095b979e h1:/ILuS9M9V3Lbd6ix0eA3uocsndU2hdn7K1NSGPQ2XAU= -github.com/livekit/go-gst v0.2.34-0.20230901155409-dd09095b979e/go.mod h1:0hI+orMYVT61TEh429LvmoV9UmyqjeTqdJ3DW2TX114= github.com/livekit/livekit-server v1.4.6-0.20230918194757-8a0d417a8c99 h1:oFCGOuHTE2hMRG4sdzXzaamQO50IGdzUR+Y57LVVCYk= github.com/livekit/livekit-server v1.4.6-0.20230918194757-8a0d417a8c99/go.mod h1:79XweE4JYvKl3M6cbBq/pTf+zAcc2xgfoWT4UL4QGEs= github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkDaKb5iXdynYrzB84ErPPO4LbRASk58= diff --git a/pkg/config/pipeline.go b/pkg/config/pipeline.go index 00cdbec1..b0b663de 100644 --- a/pkg/config/pipeline.go +++ b/pkg/config/pipeline.go @@ -21,8 +21,8 @@ import ( "strings" "time" + "github.com/go-gst/go-gst/gst/app" "github.com/pion/webrtc/v3" - "github.com/tinyzimmer/go-gst/gst/app" "google.golang.org/protobuf/proto" "gopkg.in/yaml.v3" diff --git a/pkg/errors/errors.go b/pkg/errors/errors.go index be1063d4..ea883edd 100644 --- a/pkg/errors/errors.go +++ b/pkg/errors/errors.go @@ -19,7 +19,7 @@ import ( "fmt" "strings" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/psrpc" ) diff --git a/pkg/gstreamer/bin.go b/pkg/gstreamer/bin.go index dc26e48d..02adc096 100644 --- a/pkg/gstreamer/bin.go +++ b/pkg/gstreamer/bin.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" "github.com/livekit/protocol/logger" @@ -421,8 +421,8 @@ func linkPeersLocked(src, sink *Bin) error { return err } - srcState := src.bin.GetState() - sinkState := sink.bin.GetState() + srcState := src.bin.GetCurrentState() + sinkState := sink.bin.GetCurrentState() if srcState != sinkState { if srcState == gst.StateNull { diff --git a/pkg/gstreamer/builder.go b/pkg/gstreamer/builder.go index 69bd982b..1ac64c5a 100644 --- a/pkg/gstreamer/builder.go +++ b/pkg/gstreamer/builder.go @@ -15,7 +15,7 @@ package gstreamer import ( - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" ) diff --git a/pkg/gstreamer/callbacks.go b/pkg/gstreamer/callbacks.go index 9ed44415..ebab2c5f 100644 --- a/pkg/gstreamer/callbacks.go +++ b/pkg/gstreamer/callbacks.go @@ -18,7 +18,7 @@ import ( "sync" "time" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" diff --git a/pkg/gstreamer/pads.go b/pkg/gstreamer/pads.go index 3b202550..bee84a3e 100644 --- a/pkg/gstreamer/pads.go +++ b/pkg/gstreamer/pads.go @@ -18,7 +18,7 @@ import ( "fmt" "strings" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" "github.com/livekit/protocol/logger" diff --git a/pkg/gstreamer/pipeline.go b/pkg/gstreamer/pipeline.go index cd0dc805..de480b98 100644 --- a/pkg/gstreamer/pipeline.go +++ b/pkg/gstreamer/pipeline.go @@ -18,8 +18,8 @@ import ( "time" "github.com/frostbyte73/core" - "github.com/tinyzimmer/go-glib/glib" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-glib/glib" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" "github.com/livekit/protocol/logger" diff --git a/pkg/pipeline/builder/audio.go b/pkg/pipeline/builder/audio.go index 4be12803..0e7a8e93 100644 --- a/pkg/pipeline/builder/audio.go +++ b/pkg/pipeline/builder/audio.go @@ -18,7 +18,7 @@ import ( "fmt" "sync" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" diff --git a/pkg/pipeline/builder/file.go b/pkg/pipeline/builder/file.go index 00f99c93..daabacb7 100644 --- a/pkg/pipeline/builder/file.go +++ b/pkg/pipeline/builder/file.go @@ -15,7 +15,7 @@ package builder import ( - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" diff --git a/pkg/pipeline/builder/image.go b/pkg/pipeline/builder/image.go index eca0807c..0c6e2e47 100644 --- a/pkg/pipeline/builder/image.go +++ b/pkg/pipeline/builder/image.go @@ -19,11 +19,12 @@ import ( "path" "time" + "github.com/go-gst/go-gst/gst" + "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" "github.com/livekit/egress/pkg/gstreamer" "github.com/livekit/egress/pkg/types" - "github.com/tinyzimmer/go-gst/gst" ) const ( diff --git a/pkg/pipeline/builder/segment.go b/pkg/pipeline/builder/segment.go index 8370a7a8..fbd692d8 100644 --- a/pkg/pipeline/builder/segment.go +++ b/pkg/pipeline/builder/segment.go @@ -19,7 +19,7 @@ import ( "path" "time" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" @@ -67,7 +67,7 @@ func BuildSegmentBin(pipeline *gstreamer.Pipeline, p *config.PipelineConfig) (*g _, err = sink.Connect("format-location-full", func(self *gst.Element, fragmentId uint, firstSample *gst.Sample) string { var pts time.Duration if firstSample != nil && firstSample.GetBuffer() != nil { - pts = firstSample.GetBuffer().PresentationTimestamp() + pts = *firstSample.GetBuffer().PresentationTimestamp().AsDuration() } else { logger.Infow("nil sample passed into 'format-location-full' event handler, assuming 0 pts") } diff --git a/pkg/pipeline/builder/stream.go b/pkg/pipeline/builder/stream.go index c0ded8aa..3129f9fc 100644 --- a/pkg/pipeline/builder/stream.go +++ b/pkg/pipeline/builder/stream.go @@ -18,7 +18,7 @@ import ( "fmt" "sync" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/config" "github.com/livekit/egress/pkg/errors" diff --git a/pkg/pipeline/builder/video.go b/pkg/pipeline/builder/video.go index cf8be6fa..eab01eb2 100644 --- a/pkg/pipeline/builder/video.go +++ b/pkg/pipeline/builder/video.go @@ -21,8 +21,8 @@ import ( "time" "unsafe" - "github.com/tinyzimmer/go-glib/glib" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-glib/glib" + "github.com/go-gst/go-gst/gst" "go.uber.org/atomic" "github.com/livekit/egress/pkg/config" @@ -687,10 +687,11 @@ func (b *VideoBin) createSrcPad(trackID string) { for b.nextPTS.Load() != 0 { time.Sleep(time.Millisecond * 100) } - if buffer.PresentationTimestamp() < b.lastPTS.Load() { + pts := *buffer.PresentationTimestamp().AsDuration() + if pts < b.lastPTS.Load() { return gst.PadProbeDrop } - b.lastPTS.Store(buffer.PresentationTimestamp()) + b.lastPTS.Store(pts) return gst.PadProbeOK }) b.pads[trackID] = pad @@ -703,10 +704,11 @@ func (b *VideoBin) createTestSrcPad() { pad := b.selector.GetRequestPad("sink_%u") pad.AddProbe(gst.PadProbeTypeBuffer, func(pad *gst.Pad, info *gst.PadProbeInfo) gst.PadProbeReturn { buffer := info.GetBuffer() - if buffer.PresentationTimestamp() < b.lastPTS.Load() { + pts := *buffer.PresentationTimestamp().AsDuration() + if pts < b.lastPTS.Load() { return gst.PadProbeDrop } - if nextPTS := b.nextPTS.Load(); nextPTS != 0 && buffer.PresentationTimestamp() >= nextPTS { + if nextPTS := b.nextPTS.Load(); nextPTS != 0 && pts >= nextPTS { if err := b.setSelectorPad(b.nextPad); err != nil { logger.Errorw("failed to unmute", err) return gst.PadProbeDrop @@ -715,7 +717,7 @@ func (b *VideoBin) createTestSrcPad() { b.nextPTS.Store(0) } if b.selectedPad == videoTestSrcName { - b.lastPTS.Store(buffer.PresentationTimestamp()) + b.lastPTS.Store(pts) } return gst.PadProbeOK }) diff --git a/pkg/pipeline/builder/websocket.go b/pkg/pipeline/builder/websocket.go index 41f72492..55ed0f44 100644 --- a/pkg/pipeline/builder/websocket.go +++ b/pkg/pipeline/builder/websocket.go @@ -15,8 +15,8 @@ package builder import ( - "github.com/tinyzimmer/go-gst/gst" - "github.com/tinyzimmer/go-gst/gst/app" + "github.com/go-gst/go-gst/gst" + "github.com/go-gst/go-gst/gst/app" "github.com/livekit/egress/pkg/gstreamer" ) diff --git a/pkg/pipeline/controller.go b/pkg/pipeline/controller.go index 7c2b8552..8aae704f 100644 --- a/pkg/pipeline/controller.go +++ b/pkg/pipeline/controller.go @@ -20,7 +20,7 @@ import ( "time" "github.com/frostbyte73/core" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "go.uber.org/zap" "github.com/livekit/egress/pkg/config" diff --git a/pkg/pipeline/debug.go b/pkg/pipeline/debug.go index 2ff1f1b1..0f2ca1c1 100644 --- a/pkg/pipeline/debug.go +++ b/pkg/pipeline/debug.go @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" "github.com/livekit/egress/pkg/pipeline/sink/uploader" diff --git a/pkg/pipeline/sink/websocket.go b/pkg/pipeline/sink/websocket.go index 86ce787b..a9e72db2 100644 --- a/pkg/pipeline/sink/websocket.go +++ b/pkg/pipeline/sink/websocket.go @@ -22,9 +22,9 @@ import ( "sync" "time" + "github.com/go-gst/go-gst/gst" + "github.com/go-gst/go-gst/gst/app" "github.com/gorilla/websocket" - "github.com/tinyzimmer/go-gst/gst" - "github.com/tinyzimmer/go-gst/gst/app" "go.uber.org/atomic" "github.com/livekit/egress/pkg/config" diff --git a/pkg/pipeline/source/sdk.go b/pkg/pipeline/source/sdk.go index 8af69ec6..7c99d0e4 100644 --- a/pkg/pipeline/source/sdk.go +++ b/pkg/pipeline/source/sdk.go @@ -23,9 +23,9 @@ import ( "time" "github.com/frostbyte73/core" + "github.com/go-gst/go-gst/gst" + "github.com/go-gst/go-gst/gst/app" "github.com/pion/webrtc/v3" - "github.com/tinyzimmer/go-gst/gst" - "github.com/tinyzimmer/go-gst/gst/app" "go.uber.org/atomic" "github.com/livekit/egress/pkg/config" diff --git a/pkg/pipeline/source/sdk/appwriter.go b/pkg/pipeline/source/sdk/appwriter.go index e64d851b..b6f0b56b 100644 --- a/pkg/pipeline/source/sdk/appwriter.go +++ b/pkg/pipeline/source/sdk/appwriter.go @@ -22,11 +22,11 @@ import ( "time" "github.com/frostbyte73/core" + "github.com/go-gst/go-gst/gst" + "github.com/go-gst/go-gst/gst/app" "github.com/pion/rtp" "github.com/pion/rtp/codecs" "github.com/pion/webrtc/v3" - "github.com/tinyzimmer/go-gst/gst" - "github.com/tinyzimmer/go-gst/gst/app" "go.uber.org/atomic" "github.com/livekit/egress/pkg/config" @@ -350,7 +350,7 @@ func (w *AppWriter) pushPacket(pkt *rtp.Packet, pts time.Duration) error { } b := gst.NewBufferFromBytes(p) - b.SetPresentationTimestamp(pts) + b.SetPresentationTimestamp(gst.ClockTime(uint64(pts))) if flow := w.src.PushBuffer(b); flow != gst.FlowOK { w.logger.Infow("unexpected flow return", "flow", flow) } diff --git a/pkg/pipeline/watch.go b/pkg/pipeline/watch.go index 069b245a..ca316125 100644 --- a/pkg/pipeline/watch.go +++ b/pkg/pipeline/watch.go @@ -21,8 +21,8 @@ import ( "strings" "time" - "github.com/tinyzimmer/go-glib/glib" - "github.com/tinyzimmer/go-gst/gst" + "github.com/go-gst/go-glib/glib" + "github.com/go-gst/go-gst/gst" "github.com/livekit/egress/pkg/errors" "github.com/livekit/egress/pkg/pipeline/builder"