mirror of
https://github.com/livekit/livekit.git
synced 2026-05-14 18:25:24 +00:00
vp8 temporal layer selection with dependency descriptor (#3302)
* vp8 with dd * make temporal layer selection work with DD * fix test --------- Co-authored-by: boks1971 <raja.gobi@tutanota.com>
This commit is contained in:
@@ -229,7 +229,7 @@ func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapabili
|
||||
for _, ext := range params.HeaderExtensions {
|
||||
switch ext.URI {
|
||||
case dd.ExtensionURI:
|
||||
if IsSvcCodec(codec.MimeType) {
|
||||
if IsSvcCodec(codec.MimeType) || strings.EqualFold(codec.MimeType, webrtc.MimeTypeVP8) {
|
||||
if b.ddExtID != 0 {
|
||||
b.logger.Warnw("multiple dependency descriptor extensions found", nil, "id", ext.ID, "previous", b.ddExtID)
|
||||
continue
|
||||
|
||||
@@ -226,7 +226,7 @@ func (v *VP8) UpdateAndGet(extPkt *buffer.ExtPacket, snOutOfOrder bool, snHasGap
|
||||
// which layer the missing packets belong to. A layer could have multiple packets. So, keep track
|
||||
// of pictures that are forwarded even though they will be filtered out based on temporal layer
|
||||
// requirements. That allows forwarding of the complete picture.
|
||||
if vp8.T && vp8.TID > uint8(maxTemporalLayer) {
|
||||
if extPkt.Temporal > maxTemporalLayer {
|
||||
v.exemptedPictureIds.Set(extPictureId, true)
|
||||
// trim cache if necessary
|
||||
for v.exemptedPictureIds.Len() > exemptedPictureIdsThreshold {
|
||||
@@ -235,7 +235,7 @@ func (v *VP8) UpdateAndGet(extPkt *buffer.ExtPacket, snOutOfOrder bool, snHasGap
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if vp8.T && vp8.TID > uint8(maxTemporalLayer) {
|
||||
if extPkt.Temporal > maxTemporalLayer {
|
||||
// drop only if not exempted
|
||||
_, ok := v.exemptedPictureIds.Get(extPictureId)
|
||||
if !ok {
|
||||
|
||||
@@ -85,6 +85,9 @@ func GetTestExtPacketVP8(params *TestExtPacketParams, vp8 *buffer.VP8) (*buffer.
|
||||
|
||||
ep.KeyFrame = vp8.IsKeyFrame
|
||||
ep.Payload = *vp8
|
||||
if ep.DependencyDescriptor == nil {
|
||||
ep.Temporal = int32(vp8.TID)
|
||||
}
|
||||
return ep, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@ func (v *VP8) Select(extPkt *buffer.ExtPacket, current int32, target int32) (thi
|
||||
}
|
||||
|
||||
vp8, ok := extPkt.Payload.(buffer.VP8)
|
||||
if !ok || !vp8.T {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
tid := int32(vp8.TID)
|
||||
tid := extPkt.Temporal
|
||||
if current < target {
|
||||
if tid > current && tid <= target && vp8.S && vp8.Y {
|
||||
if tid > current && tid <= target && vp8.S {
|
||||
this = tid
|
||||
next = tid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user