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 {
|
for _, ext := range params.HeaderExtensions {
|
||||||
switch ext.URI {
|
switch ext.URI {
|
||||||
case dd.ExtensionURI:
|
case dd.ExtensionURI:
|
||||||
if IsSvcCodec(codec.MimeType) {
|
if IsSvcCodec(codec.MimeType) || strings.EqualFold(codec.MimeType, webrtc.MimeTypeVP8) {
|
||||||
if b.ddExtID != 0 {
|
if b.ddExtID != 0 {
|
||||||
b.logger.Warnw("multiple dependency descriptor extensions found", nil, "id", ext.ID, "previous", b.ddExtID)
|
b.logger.Warnw("multiple dependency descriptor extensions found", nil, "id", ext.ID, "previous", b.ddExtID)
|
||||||
continue
|
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
|
// 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
|
// of pictures that are forwarded even though they will be filtered out based on temporal layer
|
||||||
// requirements. That allows forwarding of the complete picture.
|
// requirements. That allows forwarding of the complete picture.
|
||||||
if vp8.T && vp8.TID > uint8(maxTemporalLayer) {
|
if extPkt.Temporal > maxTemporalLayer {
|
||||||
v.exemptedPictureIds.Set(extPictureId, true)
|
v.exemptedPictureIds.Set(extPictureId, true)
|
||||||
// trim cache if necessary
|
// trim cache if necessary
|
||||||
for v.exemptedPictureIds.Len() > exemptedPictureIdsThreshold {
|
for v.exemptedPictureIds.Len() > exemptedPictureIdsThreshold {
|
||||||
@@ -235,7 +235,7 @@ func (v *VP8) UpdateAndGet(extPkt *buffer.ExtPacket, snOutOfOrder bool, snHasGap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if vp8.T && vp8.TID > uint8(maxTemporalLayer) {
|
if extPkt.Temporal > maxTemporalLayer {
|
||||||
// drop only if not exempted
|
// drop only if not exempted
|
||||||
_, ok := v.exemptedPictureIds.Get(extPictureId)
|
_, ok := v.exemptedPictureIds.Get(extPictureId)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ func GetTestExtPacketVP8(params *TestExtPacketParams, vp8 *buffer.VP8) (*buffer.
|
|||||||
|
|
||||||
ep.KeyFrame = vp8.IsKeyFrame
|
ep.KeyFrame = vp8.IsKeyFrame
|
||||||
ep.Payload = *vp8
|
ep.Payload = *vp8
|
||||||
|
if ep.DependencyDescriptor == nil {
|
||||||
|
ep.Temporal = int32(vp8.TID)
|
||||||
|
}
|
||||||
return ep, nil
|
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)
|
vp8, ok := extPkt.Payload.(buffer.VP8)
|
||||||
if !ok || !vp8.T {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
tid := int32(vp8.TID)
|
tid := extPkt.Temporal
|
||||||
if current < target {
|
if current < target {
|
||||||
if tid > current && tid <= target && vp8.S && vp8.Y {
|
if tid > current && tid <= target && vp8.S {
|
||||||
this = tid
|
this = tid
|
||||||
next = tid
|
next = tid
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user