Simplifying forwarding logic a bit (#1349)
* Notes on wht to do - Should targetLayers be altered while doing opportunistic locking - Should targetLayers be altered in any other path than stream allocator path? - Lock to layer as long as it is <= opportunistic layer - When not congested, opportunistic can be highest - When congested, opportunistic could be nil or lowest if paused is not allowed - When muting, can we hold on to current layers (or keep it as previous) and restore on unmute. - Store current/target in forwarder state and restore on seeding - Watch for looking for targetLayers, etc. when looking to insert padding packets. There may be an assumption about restarting on key frame and hence okay to insert padding when target layers are invalid. This may not be true any more when doing opportunistic forwarding. - Can we distinguish between publisher mute or dynacast (i. e. publisher side stopping) vs subscriber mute and do something useful? Publisher side mute could mean continuity in sequence numbers on a restart (might be able to catch it with opportunistic forwarding). But, there is the challenge of unmute from publisher via signalling channel vs media. If media is arriving, should subscribers do opportunistic forwarding before publisher mute state update happens? - Maybe introduce a mode where forwarding continues to a frame end (of course with a time limit just in case the end of frame packet is lost) and then insert silence/padding packets? - Ensure that audio blank frame insertion does not suffer from frame boundary issues. * pub/sub mute separate + more notes on things to check * WIP commit, more notes * WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * WIP commit * clean up * slightly better comments * Do not stop on unmute * do not inject blank frames when pub muted * do not forward on audio publisher mute
This commit is contained in:
@@ -17,7 +17,7 @@ type targetLayer struct {
|
||||
type DDVideoLayerSelector struct {
|
||||
logger logger.Logger
|
||||
|
||||
// TODO : fields for frame chain detect
|
||||
// DD-TODO : fields for frame chain detect
|
||||
// frameNumberWrapper Uint16Wrapper
|
||||
// expectKeyFrame bool
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *DDVideoLayerSelector) Select(expPkt *buffer.ExtPacket, tp *TranslationP
|
||||
|
||||
if expPkt.DependencyDescriptor.AttachedStructure != nil {
|
||||
// update decode target layer and active decode targets
|
||||
// TODO : these targets info can be shared by all the downtracks, no need calculate in every selector
|
||||
// DD-TODO : these targets info can be shared by all the downtracks, no need calculate in every selector
|
||||
s.updateDependencyStructure(expPkt.DependencyDescriptor.AttachedStructure)
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (s *DDVideoLayerSelector) Select(expPkt *buffer.ExtPacket, tp *TranslationP
|
||||
return true
|
||||
}
|
||||
|
||||
// TODO : we don't have a rtp queue to ensure the order of packets now,
|
||||
// DD-TODO : we don't have a rtp queue to ensure the order of packets now,
|
||||
// so we don't know packet is lost/out of order, that cause us can't detect
|
||||
// frame integrity, entire frame is forwareded, whether frame chain is broken.
|
||||
// So use a simple check here, assume all the reference frame is forwarded and
|
||||
@@ -69,7 +69,7 @@ func (s *DDVideoLayerSelector) Select(expPkt *buffer.ExtPacket, tp *TranslationP
|
||||
// find target match with selected layer
|
||||
if dt.Layer.Spatial <= s.layer.Spatial && dt.Layer.Temporal <= s.layer.Temporal {
|
||||
if activeDecodeTargets == nil || ((*activeDecodeTargets)&(1<<dt.Target) != 0) {
|
||||
// TODO : check frame chain integrity
|
||||
// DD-TODO : check frame chain integrity
|
||||
currentTarget = dt.Target
|
||||
// s.logger.Debugw("select target", "target", currentTarget, "layer", dt.layer, "dtis", expPkt.DependencyDescriptor.FrameDependencies.DecodeTargetIndications)
|
||||
break
|
||||
@@ -92,7 +92,7 @@ func (s *DDVideoLayerSelector) Select(expPkt *buffer.ExtPacket, tp *TranslationP
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO : if bandwidth in congest, could drop the 'Discardable' packet
|
||||
// DD-TODO : if bandwidth in congest, could drop the 'Discardable' packet
|
||||
if dti := dtis[currentTarget]; dti == dd.DecodeTargetNotPresent {
|
||||
// s.logger.Debugw(fmt.Sprintf("drop packet for decode target not present, dtis %v, currentTarget %d, s:%d, t:%d", dtis, currentTarget,
|
||||
// expPkt.DependencyDescriptor.FrameDependencies.SpatialId, expPkt.DependencyDescriptor.FrameDependencies.TemporalId))
|
||||
@@ -101,7 +101,7 @@ func (s *DDVideoLayerSelector) Select(expPkt *buffer.ExtPacket, tp *TranslationP
|
||||
tp.switchingToTargetLayer = true
|
||||
}
|
||||
|
||||
// TODO : add frame to forwarded queue if entire frame is forwarded
|
||||
// DD-TODO : add frame to forwarded queue if entire frame is forwarded
|
||||
// s.logger.Debugw("select packet", "target", currentTarget, "layer", s.layer)
|
||||
|
||||
tp.ddExtension = &dd.DependencyDescriptorExtension{
|
||||
@@ -176,7 +176,7 @@ func (s *DDVideoLayerSelector) updateDependencyStructure(structure *dd.FrameDepe
|
||||
s.logger.Debugw(fmt.Sprintf("update decode targets: %v", s.decodeTargetLayer))
|
||||
}
|
||||
|
||||
// TODO : use generic wrapper when updated to go 1.18
|
||||
// DD-TODO : use generic wrapper when updated to go 1.18
|
||||
type Uint16Wrapper struct {
|
||||
last_value *uint16
|
||||
lastUnwrapped int32
|
||||
|
||||
Reference in New Issue
Block a user