Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tinyzimmer -> go-gst #515

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion pkg/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"strings"

"github.com/tinyzimmer/go-gst/gst"
"github.com/go-gst/go-gst/gst"

"github.com/livekit/psrpc"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/gstreamer/bin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gstreamer/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/gstreamer/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gstreamer/pads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions pkg/gstreamer/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/builder/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/builder/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion pkg/pipeline/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/builder/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/builder/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 9 additions & 7 deletions pkg/pipeline/builder/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/builder/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/sink/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/source/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions pkg/pipeline/source/sdk/appwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/pipeline/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down