1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Use a partition tail checker in the diskwriter.

Now that we have our own samplebuilder, we can use the mark bit
to avoid dropping packets before a dropped packet.
This commit is contained in:
Juliusz Chroboczek 2021-07-11 21:01:10 +02:00
parent e840e53ac2
commit eec6c8a5b0
3 changed files with 21 additions and 3 deletions

View file

@ -308,6 +308,15 @@ func newDiskConn(client *Client, directory string, up conn.Up, remoteTracks []co
tracks: make([]*diskTrack, 0, len(tracks)), tracks: make([]*diskTrack, 0, len(tracks)),
remote: up, remote: up,
} }
truePartitionTailChecker := func(p *rtp.Packet) bool {
return true
}
markerPartitionTailChecker := func(p *rtp.Packet) bool {
return p.Marker
}
for _, remote := range tracks { for _, remote := range tracks {
var builder *samplebuilder.SampleBuilder var builder *samplebuilder.SampleBuilder
codec := remote.Codec() codec := remote.Codec()
@ -317,6 +326,9 @@ func newDiskConn(client *Client, directory string, up conn.Up, remoteTracks []co
samplebuilder.WithPartitionHeadChecker( samplebuilder.WithPartitionHeadChecker(
&codecs.OpusPartitionHeadChecker{}, &codecs.OpusPartitionHeadChecker{},
), ),
samplebuilder.WithPartitionTailChecker(
truePartitionTailChecker,
),
) )
} else if strings.EqualFold(codec.MimeType, "video/vp8") { } else if strings.EqualFold(codec.MimeType, "video/vp8") {
builder = samplebuilder.New( builder = samplebuilder.New(
@ -324,6 +336,9 @@ func newDiskConn(client *Client, directory string, up conn.Up, remoteTracks []co
samplebuilder.WithPartitionHeadChecker( samplebuilder.WithPartitionHeadChecker(
&codecs.VP8PartitionHeadChecker{}, &codecs.VP8PartitionHeadChecker{},
), ),
samplebuilder.WithPartitionTailChecker(
markerPartitionTailChecker,
),
) )
conn.hasVideo = true conn.hasVideo = true
} else if strings.EqualFold(codec.MimeType, "video/vp9") { } else if strings.EqualFold(codec.MimeType, "video/vp9") {
@ -332,6 +347,9 @@ func newDiskConn(client *Client, directory string, up conn.Up, remoteTracks []co
samplebuilder.WithPartitionHeadChecker( samplebuilder.WithPartitionHeadChecker(
&codecs.VP9PartitionHeadChecker{}, &codecs.VP9PartitionHeadChecker{},
), ),
samplebuilder.WithPartitionTailChecker(
markerPartitionTailChecker,
),
) )
conn.hasVideo = true conn.hasVideo = true
} else { } else {

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.13
require ( require (
github.com/at-wat/ebml-go v0.16.0 github.com/at-wat/ebml-go v0.16.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/jech/samplebuilder v0.0.0-20210711181036-7fcbcf0988c5 github.com/jech/samplebuilder v0.0.0-20210711185346-d34c6dd315fb
github.com/pion/ice/v2 v2.1.8 github.com/pion/ice/v2 v2.1.8
github.com/pion/rtcp v1.2.6 github.com/pion/rtcp v1.2.6
github.com/pion/rtp v1.6.6-0.20210512022946-4e87540a7fe6 github.com/pion/rtp v1.6.6-0.20210512022946-4e87540a7fe6

4
go.sum
View file

@ -22,8 +22,8 @@ github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jech/samplebuilder v0.0.0-20210711181036-7fcbcf0988c5 h1:ek+KpVz14p6ytAtzMSktZNgtq2Vq6GkIcWiJDv3eP3s= github.com/jech/samplebuilder v0.0.0-20210711185346-d34c6dd315fb h1:ctDbFqRHUmxTThbYcTP2cdOVOkECsvhNyQKqeEK7RQQ=
github.com/jech/samplebuilder v0.0.0-20210711181036-7fcbcf0988c5/go.mod h1:PXhvo7PKy8CVqirCgoNG2BIjwow2Zd6LwCTScabl584= github.com/jech/samplebuilder v0.0.0-20210711185346-d34c6dd315fb/go.mod h1:PXhvo7PKy8CVqirCgoNG2BIjwow2Zd6LwCTScabl584=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=