Skip to content

Software path: nothing measures the decoded read-ahead, so an IO hiccup arrives with no cushion figure in the log #303

Description

@superuser404notfound

Split out of #295, where a ~100 ms blocked read on the demux thread turned into a visible picture stutter. The read defect is fixed. What is left is that nobody, including me, could say from a log how much cushion the software path had when it hit.

What actually bounds the read-ahead today

One thing, and it is not ours:

// SoftwarePlaybackHost.swift, runDemuxLoop
while !renderer.isReadyForMoreMediaData && !stopRequested() && !backgroundAudioOnly() {
    Thread.sleep(forTimeInterval: 0.005)
}

SampleBufferRenderer.isReadyForMoreMediaData forwards to AVSampleBufferVideoRenderer, whose fill policy is an AVFoundation heuristic. There is no target depth in seconds, no floor before playback starts, and no re-fill target after a stall. The 4-frame reorder buffer is for B-frame ordering and is not a cushion.

That may well be fine. The point is that it is unmeasured, so the question cannot be settled either way from a field trace.

Three signals that look like they answer it and do not

So a session can show a full queue at enqueue #8, a healthy demuxed frontier, frameAhead=0.00s, and still drop frames from a 100 ms read, with nothing in the log distinguishing "the cushion was 40 ms" from "the cushion was 2 s and something else broke".

What would settle it

  1. Seconds of decoded video actually queued for display: the enqueued-frame PTS frontier minus the synchronizer time, sampled in the periodic memprobe rather than only at milestones. That is the number that decides whether a given read block is survivable.
  2. A presented/dropped split on the software path, which is what the Software-path SD MPEG-2 (PAL 25i): intermittent brief picture glitches with no engine-log signature — first seen on 6.5.3, unchanged on 6.5.6 #295 reporter asked for when the defect had no signature.

With those two, the design question underneath becomes answerable rather than a matter of taste: whether the software path should hold a floor of its own instead of inheriting whatever AVSampleBufferVideoRenderer happens to accept, and whether that floor should differ for a remote source and a local one.

No user-visible symptom is attached to this issue on its own. It is the instrument that was missing while #295 was open.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions