Skip to content

fix(disc): count a remote disc image's source bytes in telemetry - #719

Merged
superuser404notfound merged 3 commits into
superuser404notfound:mainfrom
yipengfei329:fix/disc-source-bytes-telemetry
Oct 8, 2026
Merged

superuser404notfound merged 3 commits into
superuser404notfound:mainfrom
yipengfei329:fix/disc-source-bytes-telemetry

Conversation

@yipengfei329

Copy link
Copy Markdown
Contributor

Summary

LiveTelemetry.demuxerBytesFetched is documented as the bytes a session pulled from the source, but it read 0 for every source opened through a custom reader, because CustomIOReaderBridge reports a constant 0. A disc image played over HTTP therefore showed no origin bytes and, on the software path, no networkThroughputMbps, although HTTPDiscIOReader pulled the whole title. This is the first focused piece of the set in #703 (MovieClaw P19).

What changed

  • HTTPDiscIOReader counts the response bodies fetchWithRetry receives, per instance (a retried or rejected body counts too, since it crossed the link). The process-wide lifetimeFetchedBytes used by the memory probe is unchanged.
  • ConcatIOReader passes its base reader's count through: the extent map adds no transfer of its own.
  • CustomIOReaderBridge.cumulativeBytesFetched reports the reader's count through an internal SourceTransferCounting seam. A host's own IOReader is not asked and still reports 0, which keeps the AVIOProvider contract ("custom readers that do not track network I/O report 0") for local files, SMB and memory readers.
  • No public API change. Note that the memory probe's avioMB column now also reflects disc reads on that path, alongside its separate discFetchedMB column.

Test plan

  • Device / OS: MacBook Pro (M2 Max), macOS 27.0.1, Xcode 27.0 (27A266a).
  • Source media: 49.5 GB Blu-ray ISO (H.264 1080p, DTS-HD MA + DTS/AC-3, 47 titles), served over HTTP with byte ranges from a local range server.
  • Result, aetherctl play --seconds 15/25 http://127.0.0.1:8931/disc.iso:
    • main (7.28.3): origin=0.0MB on every tick.
    • This branch: origin 107.5 MB at t=1 rising to 367.5 MB at t=25, stepping with the reader's refills; playback, disc recognition and the verdict are unchanged.
  • New tests in HTTPDiscIOReaderTests: the reader counts the transfer (one 64 KiB refill for a 6000-byte read, nothing for a re-read inside the buffer, the refill after a seek); a disc wrapped over HTTP reports the reader's count through the extent map and the bridge; a host reader still reports 0.
  • Full swift test --jobs 8: 718 XCTest cases (1 skipped) and 4,087 Swift Testing cases in 567 suites, all passing. Scripts/check-doc-links.py passes.

Checklist

  • CHANGELOG.md updated
  • Commit messages follow Conventional Commits (feat(...), fix(...), chore(...))
  • The fix lives in the engine, not in a host-side workaround
  • Public API changes are intentional and documented (none)

🤖 Generated with Claude Code

@yipengfei329
yipengfei329 marked this pull request as ready for review October 7, 2026 14:12
@yipengfei329
yipengfei329 force-pushed the fix/disc-source-bytes-telemetry branch from 0134fc2 to 3a97079 Compare October 7, 2026 17:07
LiveTelemetry.demuxerBytesFetched read 0 for every custom-reader source,
because CustomIOReaderBridge reported a constant 0. A disc image played over
HTTP therefore showed no origin bytes and, on the software path, no
networkThroughputMbps, although HTTPDiscIOReader pulled the whole title.

HTTPDiscIOReader now counts the response bodies it receives, ConcatIOReader
passes its base reader's count through, and the bridge reports it. A host's
own IOReader is not asked and still reports 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yipengfei329
yipengfei329 force-pushed the fix/disc-source-bytes-telemetry branch from 3a97079 to 1da10e6 Compare October 7, 2026 17:14
@superuser404notfound
superuser404notfound merged commit 7383a40 into superuser404notfound:main Oct 8, 2026
4 checks passed
@superuser404notfound

Copy link
Copy Markdown
Owner

Merged in 7383a40, thank you. This is exactly the shape that works well here: one defect, a measurement before and after, no public API change, and tests that pin both the counting reader and the host reader that must keep reporting 0.

Two notes on what happened on the way in:

It ships with the next release.

@superuser404notfound

Copy link
Copy Markdown
Owner

Released in 7.31.2 (5643f9d).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants