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

Fix layer dimension calculation logic #143

Merged
merged 14 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
7 changes: 5 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
env:
GOVERSION: "1.20.7"
GSTVERSION: "1.22.5"

jobs:
integration:
Expand All @@ -37,5 +40,5 @@ jobs:
~/.cache
key: ingress

- name: Build docker image
run: docker build -t ingress -f ./build/ingress/Dockerfile .
- name: Build docker imagARG GOVERSION
run: docker build -t ingress -f ./build/ingress/Dockerfile --build-arg GOVERSION=$GOVERSION --build-arg GSTVERSION=$GSTVERSION .
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
go-version: 1.20

- name: Download Go modules
run: go mod download
Expand Down
14 changes: 11 additions & 3 deletions build/ingress/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM livekit/gstreamer:1.20.4-dev
ARG GSTVERSION

FROM livekit/gstreamer:$GSTVERSION-dev

ARG TARGETPLATFORM
ARG GOVERSION

WORKDIR /workspace

# install go
RUN apt-get update && apt-get install -y golang
RUN apt-get update && apt-get install -y curl

RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then GOARCH=arm64; else GOARCH=amd64; fi && \
curl -L -o /tmp/go.tar.gz "https://go.dev/dl/go$GOVERSION.linux-$GOARCH.tar.gz"
RUN tar -C /usr/local -xzf /tmp/go.tar.gz
ENV PATH="$PATH:/usr/local/go/bin"

# download go modules
COPY go.mod .
Expand All @@ -35,7 +43,7 @@ COPY version/ version/
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then GOARCH=arm64; else GOARCH=amd64; fi && \
CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} GO111MODULE=on go build -a -o ingress ./cmd/server

FROM livekit/gstreamer:1.20.4-prod
FROM livekit/gstreamer:$GSTVERSION-prod

# install wget for health check
RUN apt-get update && apt-get install -y wget
Expand Down
7 changes: 6 additions & 1 deletion build/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ WORKDIR /workspace
# install deps
RUN apt-get update && \
apt-get install -y \
golang
curl

RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then GOARCH=arm64; else GOARCH=amd64; fi && \
curl -L -o /tmp/go.tar.gz "https://go.dev/dl/go1.20.7.linux-$GOARCH.tar.gz"
RUN tar -C /usr/local -xzf /tmp/go.tar.gz
ENV PATH="$PATH:/usr/local/go/bin"

# download go modules
COPY go.mod .
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ module github.com/livekit/ingress

go 1.18

replace github.com/tinyzimmer/go-glib => github.com/livekit/go-glib v0.0.0-20230811224737-7bfaa4e57420

require (
github.com/Eyevinn/mp4ff v0.35.0
github.com/frostbyte73/core v0.0.9
github.com/gorilla/mux v1.8.0
github.com/livekit/go-rtmp v0.0.0-20230317185657-6e9cfa387c7e
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a
github.com/livekit/protocol v1.6.0
github.com/livekit/protocol v1.6.1-0.20230811231353-14b7eb70d2b7
github.com/livekit/psrpc v0.3.2
github.com/livekit/server-sdk-go v1.0.16-0.20230808010703-d4a4451efa06
github.com/pion/dtls/v2 v2.2.7
Expand Down Expand Up @@ -84,10 +86,10 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yutopp/go-amf0 v0.0.0-20180803120851-48851794bb1f // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b // indirect
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.10.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/Eyevinn/mp4ff v0.35.0 h1:umuXXGwBRiuJ671aUbM4Z/ZCt4FNdoLg5PC4clmxVO8=
github.com/Eyevinn/mp4ff v0.35.0/go.mod h1:w/6GSa5ghZ1VavzJK6McQ2/flx8mKtcrKDr11SsEweA=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
Expand Down Expand Up @@ -81,14 +81,16 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
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-20230811224737-7bfaa4e57420 h1:b5RICTDRq0U35xgmm3VafZyh5Z7w6xFEPbT7HtgTGwQ=
github.com/livekit/go-glib v0.0.0-20230811224737-7bfaa4e57420/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM=
github.com/livekit/go-rtmp v0.0.0-20230317185657-6e9cfa387c7e h1:Fw7uyi8OK3M7iApZpE+sHnV5u7nDl3uYI5qvat6Wah4=
github.com/livekit/go-rtmp v0.0.0-20230317185657-6e9cfa387c7e/go.mod h1:X+CliWDrjhm5C+NgmxVt2ncdO3MnKDlbZHTwkuf0808=
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkDaKb5iXdynYrzB84ErPPO4LbRASk58=
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a h1:JWpPHcMFuw0fP4swE89CfMgeUXiSN5IKvCJL/5HLI3A=
github.com/livekit/mediatransportutil v0.0.0-20230716190407-fc4944cbc33a/go.mod h1:xirUXW8xnLGmfCwUeAv/nj1VGo1OO1BmgxrYP7jK/14=
github.com/livekit/protocol v1.6.0 h1:19S+vFZqnivKIOpyR3DEK/mSaykQ3UEf7H2G/mBOE54=
github.com/livekit/protocol v1.6.0/go.mod h1:SUS9foM1xBzw/AFrgTJuFX/oSuwlnIbHmpdiPdCvwEM=
github.com/livekit/protocol v1.6.1-0.20230811231353-14b7eb70d2b7 h1:/nleEfMSygC5n/IMBMUh5t9jihvVqM4LRrTjkYsDO2Q=
github.com/livekit/protocol v1.6.1-0.20230811231353-14b7eb70d2b7/go.mod h1:eyzLhJLqZCLPmMUjViDDtjS/LkSiCQdsJdRBSyMvRYU=
github.com/livekit/psrpc v0.3.2 h1:eAaJhASme33gtoBhCRLH9jsnWcdm1tHWf0WzaDk56ew=
github.com/livekit/psrpc v0.3.2/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
github.com/livekit/server-sdk-go v1.0.16-0.20230808010703-d4a4451efa06 h1:CgAiAdNxKvJz+hewozwKi9WDVf4r+MDs8VpTGjXCFrA=
Expand Down Expand Up @@ -199,8 +201,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw=
github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
github.com/tinyzimmer/go-glib v0.0.25 h1:2GpumtkxA0wpXhCXP6D3ksb5pGMfo9WbhgLvEw8njK4=
github.com/tinyzimmer/go-glib v0.0.25/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM=
github.com/tinyzimmer/go-gst v0.2.33 h1:wdwUYoN7dkWGUTrZIgB9Mp5LMRr/Sld5PVGRsE7/O9s=
github.com/tinyzimmer/go-gst v0.2.33/go.mod h1:0hI+orMYVT61TEh429LvmoV9UmyqjeTqdJ3DW2TX114=
github.com/twitchtv/twirp v8.1.3+incompatible h1:+F4TdErPgSUbMZMwp13Q/KgDVuI7HJXP61mNV3/7iuU=
Expand All @@ -220,11 +220,11 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand All @@ -234,8 +234,8 @@ golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI=
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/image v0.7.0 h1:gzS29xtG1J5ybQlv0PuyfE3nmc6R4qB73m6LUUmvFuw=
golang.org/x/image v0.7.0/go.mod h1:nd/q4ef1AKKYl/4kft7g+6UyGbdiqWqTP1ZAbRoV7Rg=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand Down
7 changes: 4 additions & 3 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ var Default = Build

const (
imageName = "livekit/ingress"
gstVersion = "1.20.4"
gstVersion = "1.22.5"
goVersion = "1.20.7"
)

var plugins = []string{"gstreamer", "gst-plugins-base", "gst-plugins-good", "gst-plugins-bad", "gst-plugins-ugly", "gst-libav"}
Expand Down Expand Up @@ -117,15 +118,15 @@ func BuildDocker() error {
return mageutil.Run(context.Background(),
fmt.Sprintf("docker pull livekit/gstreamer:%s-dev", gstVersion),
fmt.Sprintf("docker pull livekit/gstreamer:%s-prod", gstVersion),
fmt.Sprintf("docker build --no-cache -t %s:latest -f build/ingress/Dockerfile .", imageName),
fmt.Sprintf("docker build --no-cache -t %s:latest -f build/ingress/Dockerfile --build-arg GSTVERSION=%s --build-arg GOVERSION=%s .", imageName, gstVersion, goVersion),
)
}

func BuildDockerLinux() error {
return mageutil.Run(context.Background(),
fmt.Sprintf("docker pull livekit/gstreamer:%s-dev", gstVersion),
fmt.Sprintf("docker pull livekit/gstreamer:%s-prod", gstVersion),
fmt.Sprintf("docker build --no-cache --platform linux/amd64 -t %s:latest -f build/ingress/Dockerfile .", imageName),
fmt.Sprintf("docker build --no-cache --platform linux/amd64 -t %s:latest -f build/ingress/Dockerfile --build-arg GSTVERSION=%s --build-arg GOVERSION=%s .", imageName, gstVersion, goVersion),
)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/media/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewVideoOutput(codec livekit.VideoCodec, layer *livekit.VideoLayer) (*Video
}
err = inputCaps.SetProperty("caps", gst.NewCapsFromString(
fmt.Sprintf(
"video/x-raw,width=%d,height=%d",
"video/x-raw,width=[1,%d],height=[1,%d],pixel-aspect-ratio=1/1",
layer.Width,
layer.Height,
),
Expand Down
24 changes: 22 additions & 2 deletions pkg/media/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@ func New(ctx context.Context, conf *config.Config, params *params.Params) (*Pipe

func (p *Pipeline) onOutputReady(pad *gst.Pad, kind types.StreamKind) {
var err error
defer func() {
if err != nil {
p.SetStatus(livekit.IngressState_ENDPOINT_ERROR, err.Error())
p.SendStateUpdate(context.Background())
}
}()

_, err = pad.Connect("notify::caps", func(gPad *gst.GhostPad, param *glib.ParamSpec) {
p.onParamsReady(kind, gPad, param)
})
}

func (p *Pipeline) onParamsReady(kind types.StreamKind, gPad *gst.GhostPad, param *glib.ParamSpec) {
var err error

// TODO fix go-gst to not create non nil gst.Caps for a NULL native caps pointer?
caps, err := gPad.Pad.GetProperty("caps")
if err != nil || caps == nil || caps.(*gst.Caps) == nil || caps.(*gst.Caps).Unsafe() == nil {
return
}

defer func() {
if err != nil {
Expand All @@ -108,7 +128,7 @@ func (p *Pipeline) onOutputReady(pad *gst.Pad, kind types.StreamKind) {
p.SendStateUpdate(context.Background())
}()

bin, err := p.sink.AddTrack(kind)
bin, err := p.sink.AddTrack(kind, caps.(*gst.Caps))
if err != nil {
return
}
Expand All @@ -118,7 +138,7 @@ func (p *Pipeline) onOutputReady(pad *gst.Pad, kind types.StreamKind) {
return
}

pad.AddProbe(gst.PadProbeTypeBlockDownstream, func(pad *gst.Pad, info *gst.PadProbeInfo) gst.PadProbeReturn {
gPad.AddProbe(gst.PadProbeTypeBlockDownstream, func(pad *gst.Pad, info *gst.PadProbeInfo) gst.PadProbeReturn {
// link
if linkReturn := pad.Link(bin.GetStaticPad("sink")); linkReturn != gst.PadLinkOK {
logger.Errorw("failed to link output bin", err)
Expand Down
68 changes: 63 additions & 5 deletions pkg/media/webrtc_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import (

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

"github.com/livekit/ingress/pkg/errors"
"github.com/livekit/ingress/pkg/lksdk_output"
"github.com/livekit/ingress/pkg/params"
"github.com/livekit/ingress/pkg/types"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/tracer"
"github.com/livekit/protocol/utils"
Expand Down Expand Up @@ -63,27 +65,37 @@ func (s *WebRTCSink) addAudioTrack() (*Output, error) {
return output.Output, nil
}

func (s *WebRTCSink) addVideoTrack() ([]*Output, error) {
func (s *WebRTCSink) addVideoTrack(w, h int) ([]*Output, error) {
outputs := make([]*Output, 0)
sbArray := make([]lksdk_output.VideoSampleProvider, 0)
for _, layer := range s.params.VideoEncodingOptions.Layers {

sortedLayers := sortLayersByQuality(s.params.VideoEncodingOptions.Layers)

var outLayers []*livekit.VideoLayer
for _, layer := range sortedLayers {
output, err := NewVideoOutput(s.params.VideoEncodingOptions.VideoCodec, layer)
if err != nil {
return nil, err
}
outputs = append(outputs, output.Output)
sbArray = append(sbArray, output)
outLayers = append(outLayers, layer)

if layer.Width >= uint32(w) && layer.Height >= uint32(h) {
// Next quality layer would be duplicate of current one
break
}
}

err := s.sdkOut.AddVideoTrack(sbArray, s.params.VideoEncodingOptions.Layers, utils.GetMimeTypeForVideoCodec(s.params.VideoEncodingOptions.VideoCodec))
err := s.sdkOut.AddVideoTrack(sbArray, outLayers, utils.GetMimeTypeForVideoCodec(s.params.VideoEncodingOptions.VideoCodec))
if err != nil {
return nil, err
}

return outputs, nil
}

func (s *WebRTCSink) AddTrack(kind types.StreamKind) (*gst.Bin, error) {
func (s *WebRTCSink) AddTrack(kind types.StreamKind, caps *gst.Caps) (*gst.Bin, error) {
var bin *gst.Bin

switch kind {
Expand All @@ -97,7 +109,14 @@ func (s *WebRTCSink) AddTrack(kind types.StreamKind) (*gst.Bin, error) {
bin = output.bin

case types.Video:
outputs, err := s.addVideoTrack()
w, h, err := getResolution(caps)
if err != nil {
return nil, err
}

logger.Infow("source resolution parsed", "width", w, "height", h)

outputs, err := s.addVideoTrack(w, h)
if err != nil {
logger.Errorw("could not add video track", err)
return nil, err
Expand All @@ -118,3 +137,42 @@ func (s *WebRTCSink) AddTrack(kind types.StreamKind) (*gst.Bin, error) {
func (s *WebRTCSink) Close() {
s.sdkOut.Close()
}

func getResolution(caps *gst.Caps) (w int, h int, err error) {
if caps.GetSize() == 0 {
return 0, 0, errors.ErrUnsupportedDecodeFormat
}

str := caps.GetStructureAt(0)

wObj, err := str.GetValue("width")
if err != nil {
return 0, 0, err
}

hObj, err := str.GetValue("height")
if err != nil {
return 0, 0, err
}

return wObj.(int), hObj.(int), nil
}

func sortLayersByQuality(layers []*livekit.VideoLayer) []*livekit.VideoLayer {
layersByQuality := make(map[livekit.VideoQuality]*livekit.VideoLayer)

for _, layer := range layers {
layersByQuality[layer.Quality] = layer
}

var ret []*livekit.VideoLayer
for q := livekit.VideoQuality_LOW; q <= livekit.VideoQuality_HIGH; q++ {
layer, ok := layersByQuality[q]
if !ok {
continue
}

ret = append(ret, layer)
}
return ret
}
2 changes: 0 additions & 2 deletions pkg/service/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package service

import (
"context"
"fmt"
"net"
"time"

Expand Down Expand Up @@ -130,7 +129,6 @@ func (h *Handler) UpdateIngress(ctx context.Context, req *livekit.UpdateIngressR
}

func (h *Handler) DeleteIngress(ctx context.Context, req *livekit.DeleteIngressRequest) (*livekit.IngressState, error) {
fmt.Println("DELETE", req)
_, span := tracer.Start(ctx, "Handler.DeleteIngress")
defer span.End()
return h.killAndReturnState(ctx)
Expand Down
Loading