Skip to content

Commit a120d42

Browse files
chore(player): drop the temporary #92 open-GOP witness scaffolding
The per-segment witness (HEVCAccessUnitProbe + the dbg92 logging in HLSSegmentProducer) was confirmation scaffolding for the #92 diagnosis. With the keyframe-gated cut shipped and `aetherctl segverify` as the standing decode-level verifier, it is no longer needed. Removed the probe, its tests, and all dbg92 state/logging. Fix, segverify and --throttle-kbps stay. Suite green (XCTest 228, Swift Testing 268), strict-concurrency clean; segverify still reports 8/8 independent on the open-GOP fixture. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZTEfmztPE8hAdjHdBr9BH
1 parent 489e38c commit a120d42

3 files changed

Lines changed: 0 additions & 207 deletions

File tree

Sources/AetherEngine/Video/HEVCAccessUnitProbe.swift

Lines changed: 0 additions & 64 deletions
This file was deleted.

Sources/AetherEngine/Video/HLSSegmentProducer.swift

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -294,52 +294,6 @@ final class HLSSegmentProducer: @unchecked Sendable {
294294
private var firstActualVideoPts: Int64 = Int64.min
295295
private var loggedFirstLeadingDrop: Bool = false
296296

297-
// #92 diagnostics (VOD, HEVC): per-segment open-GOP witness. Confirms whether mid-stream segment
298-
// keyframes are CRA (open-GOP) vs IDR, and whether segments carry RASL leading pictures whose PTS
299-
// precedes their own keyframe (making the segment non-independent). Pure logging, no behaviour change.
300-
private var dbg92Enabled: Bool = false
301-
private var dbg92CurSeg: Int = Int.min
302-
private var dbg92CurKfType: UInt8 = 0xFF
303-
private var dbg92SegKfPts: Int64 = Int64.min
304-
private var dbg92LeadingInSeg: Int = 0
305-
private var dbg92FramesInSeg: Int = 0
306-
private var dbg92IdrSegs: Int = 0
307-
private var dbg92CraSegs: Int = 0
308-
private var dbg92NonIndependentSegs: Int = 0
309-
private var dbg92SegsSeen: Int = 0
310-
311-
/// #92: flush the accumulated open-GOP witness for the segment that just ended. Logs every
312-
/// non-independent segment (CRA keyframe carrying RASL leading pictures, the smoking gun) plus the
313-
/// first few segments verbatim, and a rolling aggregate every 50 segments to bound log volume.
314-
private func emitDbg92SegmentSummary() {
315-
guard dbg92Enabled, dbg92CurSeg != Int.min else { return }
316-
dbg92SegsSeen += 1
317-
if HEVCAccessUnitProbe.isIDR(dbg92CurKfType) { dbg92IdrSegs += 1 }
318-
if HEVCAccessUnitProbe.isCRA(dbg92CurKfType) { dbg92CraSegs += 1 }
319-
// A segment is independently decodable iff its FIRST sample is an IRAP. Open-GOP RASL that follow
320-
// the IRAP in the same segment are fine (a fresh decode discards them via NoRaslOutputFlag); only
321-
// a segment that starts on a non-IRAP (the pre-fix mid-GOP cut) is dependent on its predecessor.
322-
let startsAtIRAP = HEVCAccessUnitProbe.isIRAP(dbg92CurKfType)
323-
if !startsAtIRAP { dbg92NonIndependentSegs += 1 }
324-
if dbg92SegsSeen <= 5 || !startsAtIRAP {
325-
EngineLog.emit(
326-
"[HLSSegmentProducer] #92 seg-\(dbg92CurSeg) "
327-
+ "keyframe=\(HEVCAccessUnitProbe.label(forSliceType: dbg92CurKfType)) "
328-
+ "frames=\(dbg92FramesInSeg) leadingRASL=\(dbg92LeadingInSeg) "
329-
+ "independent=\(startsAtIRAP ? "yes" : "NO")",
330-
category: .session
331-
)
332-
}
333-
if dbg92SegsSeen % 50 == 0 {
334-
EngineLog.emit(
335-
"[HLSSegmentProducer] #92 aggregate: segs=\(dbg92SegsSeen) "
336-
+ "IDR=\(dbg92IdrSegs) CRA=\(dbg92CraSegs) "
337-
+ "nonIndependent=\(dbg92NonIndependentSegs)",
338-
category: .session
339-
)
340-
}
341-
}
342-
343297
/// Pre-gate drop counters; surface the "lädt unendlich" failure mode when the gate never opens.
344298
private var pregateVideoDropCount: Int = 0
345299
private var pregateWaitStart: Date?
@@ -597,8 +551,6 @@ final class HLSSegmentProducer: @unchecked Sendable {
597551
self.segmentBoundaries = segmentBoundaries
598552
self.vodCutter = VODSegmentCutter(boundaries: segmentBoundaries, baseIndex: baseIndex)
599553
self.isLive = isLive
600-
// #92: open-GOP witness only matters for the VOD keyframe-plan path on HEVC sources.
601-
self.dbg92Enabled = !isLive && video.codecpar.pointee.codec_id == AV_CODEC_ID_HEVC
602554
self.liveCurrentSegmentIndex = baseIndex
603555
self.videoFallbackDurationPts = videoFallbackDurationPts
604556
self.audioFallbackDurationPts = audioFallbackDurationPts
@@ -1981,29 +1933,6 @@ final class HLSSegmentProducer: @unchecked Sendable {
19811933
category: .session
19821934
)
19831935
}
1984-
// #92: per-segment open-GOP witness. The first packet routed to a new VOD segment
1985-
// is that segment's boundary keyframe (kf.dts == kf.pts == plan boundary). Frames in
1986-
// the segment whose PTS precedes the keyframe PTS are RASL leading pictures referencing
1987-
// the previous GOP -> the segment is not independently decodable (see #92 analysis).
1988-
if dbg92Enabled {
1989-
if prevSeg != dbg92CurSeg {
1990-
emitDbg92SegmentSummary()
1991-
dbg92CurSeg = prevSeg
1992-
dbg92SegKfPts = prev.pointee.pts
1993-
dbg92FramesInSeg = 0
1994-
dbg92LeadingInSeg = 0
1995-
dbg92CurKfType = 0xFF
1996-
if let data = prev.pointee.data, prev.pointee.size > 0 {
1997-
dbg92CurKfType = HEVCAccessUnitProbe.firstSliceNALType(
1998-
data, size: Int(prev.pointee.size)) ?? 0xFF
1999-
}
2000-
}
2001-
dbg92FramesInSeg += 1
2002-
if dbg92SegKfPts != Int64.min, prev.pointee.pts != Int64.min,
2003-
prev.pointee.pts < dbg92SegKfPts {
2004-
dbg92LeadingInSeg += 1
2005-
}
2006-
}
20071936
if let muxer = ensureMuxer(forSegmentIndex: prevSeg) {
20081937
finalizeAndWriteVideo(prev, nextDts: packet.pointee.dts, muxer: muxer)
20091938
bumpPacketsWritten()

Tests/AetherEngineTests/HEVCAccessUnitProbeTests.swift

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)