mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 07:00:04 +00:00
Add debugging from DD frame number wrap around. (#3933)
* Add debugging from DD frame number wrap around. On a DD parser restart, the extended highest sequence number oes not seem to be updated. Adding some debug to understand it better. * more logs * log incoming sequence number and frame number
This commit is contained in:
@@ -108,7 +108,12 @@ func (r *DependencyDescriptorParser) Parse(pkt *rtp.Packet) (*ExtDependencyDescr
|
||||
if !r.lastPacketAt.IsZero() && time.Since(r.lastPacketAt) > ddRestartThreshold {
|
||||
r.restart()
|
||||
restart = true
|
||||
r.logger.Debugw("dependency descriptor parser restart stream", "generation", r.restartGeneration)
|
||||
r.logger.Debugw(
|
||||
"dependency descriptor parser restart stream",
|
||||
"generation", r.restartGeneration,
|
||||
"lastPacketAt", r.lastPacketAt,
|
||||
"sinceLast", time.Since(r.lastPacketAt),
|
||||
)
|
||||
}
|
||||
r.lastPacketAt = time.Now()
|
||||
}
|
||||
@@ -137,7 +142,14 @@ func (r *DependencyDescriptorParser) Parse(pkt *rtp.Packet) (*ExtDependencyDescr
|
||||
extFN := unwrapped.ExtendedVal
|
||||
|
||||
if extFN < r.structureExtFrameNum {
|
||||
r.logger.Debugw("drop frame which is earlier than current structure", "frameNum", extFN, "structureFrameNum", r.structureExtFrameNum)
|
||||
r.logger.Debugw(
|
||||
"drop frame which is earlier than current structure",
|
||||
"fn", ddVal.FrameNumber,
|
||||
"extFN", extFN,
|
||||
"structureExtFrameNum", r.structureExtFrameNum,
|
||||
"unwrappedFN", unwrapped,
|
||||
"frameWrapAround", r.frameWrapAround,
|
||||
)
|
||||
return nil, videoLayer, ErrFrameEarlierThanKeyFrame
|
||||
}
|
||||
|
||||
@@ -152,17 +164,41 @@ func (r *DependencyDescriptorParser) Parse(pkt *rtp.Packet) (*ExtDependencyDescr
|
||||
|
||||
if ddVal.AttachedStructure != nil {
|
||||
if !ddVal.FirstPacketInFrame {
|
||||
r.logger.Warnw("attached structure is not the first packet in frame", nil, "extSeq", extSeq, "extFN", extFN)
|
||||
r.logger.Warnw(
|
||||
"attached structure is not the first packet in frame", nil,
|
||||
"sn", pkt.SequenceNumber,
|
||||
"extSeq", extSeq,
|
||||
"fn", ddVal.FrameNumber,
|
||||
"extFN", extFN,
|
||||
)
|
||||
return nil, videoLayer, ErrDDStructureAttachedToNonFirstPacket
|
||||
}
|
||||
|
||||
if r.structure == nil || ddVal.AttachedStructure.StructureId != r.structure.StructureId {
|
||||
r.logger.Debugw("structure updated", "structureID", ddVal.AttachedStructure.StructureId, "extSeq", extSeq, "extFN", extFN, "descriptor", ddVal.String())
|
||||
r.logger.Debugw(
|
||||
"structure updated",
|
||||
"structureID", ddVal.AttachedStructure.StructureId,
|
||||
"sn", pkt.SequenceNumber,
|
||||
"extSeq", extSeq,
|
||||
"fn", ddVal.FrameNumber,
|
||||
"extFN", extFN,
|
||||
"descriptor", ddVal.String(),
|
||||
"unwrappedFN", unwrapped,
|
||||
"frameWrapAround", r.frameWrapAround,
|
||||
)
|
||||
}
|
||||
r.structure = ddVal.AttachedStructure
|
||||
r.decodeTargets = ProcessFrameDependencyStructure(ddVal.AttachedStructure)
|
||||
if extFN > unwrapped.PreExtendedHighest && extFN-unwrapped.PreExtendedHighest > 1000 {
|
||||
r.logger.Debugw("large frame number jump on structure updating", "extFN", extFN, "preExtendedHighest", unwrapped.PreExtendedHighest, "structureExtFrameNum", r.structureExtFrameNum)
|
||||
r.logger.Debugw(
|
||||
"large frame number jump on structure updating",
|
||||
"fn", ddVal.FrameNumber,
|
||||
"extFN", extFN,
|
||||
"preExtendedHighest", unwrapped.PreExtendedHighest,
|
||||
"structureExtFrameNum", r.structureExtFrameNum,
|
||||
"unwrappedFN", unwrapped,
|
||||
"frameWrapAround", r.frameWrapAround,
|
||||
)
|
||||
}
|
||||
r.structureExtFrameNum = extFN
|
||||
extDD.StructureUpdated = true
|
||||
|
||||
@@ -51,6 +51,20 @@ func NewWrapAround[T number, ET extendedNumber](params WrapAroundParams) *WrapAr
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WrapAround[T, ET]) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||
if w == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
e.AddUint64("fullRange", uint64(w.fullRange))
|
||||
e.AddBool("initialized", w.initialized)
|
||||
e.AddUint64("start", uint64(w.start))
|
||||
e.AddUint64("highest", uint64(w.highest))
|
||||
e.AddUint64("cycles", uint64(w.cycles))
|
||||
e.AddUint64("extendedHighest", uint64(w.extendedHighest))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *WrapAround[T, ET]) Seed(from *WrapAround[T, ET]) {
|
||||
w.initialized = from.initialized
|
||||
w.start = from.start
|
||||
|
||||
Reference in New Issue
Block a user