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