Skip to content

Software path has no network telemetry: expose read bytes / throughput / buffer runway #306

Closed

Description

@kskchaitanya1993

What we can't show

Our stats overlay has a Network section — throughput, bytes transferred, buffer depth, dropped frames. On the native and loopback paths we read all of it from AVPlayerItem.accessLog(). On the software path there is no AVPlayerItem, so the whole section is blank, and there is nothing on the public diagnostics surface to put there instead.

Measured on the same build, same test bed, back to back:

raw .ts  -> backend=native   (loopback, so an AVPlayer exists)
            downloadBps 5891396   bytesLoaded 2369074
            bufferedMs 4961       droppedFrames 0

VP9      -> backend=software  vDecoder "libavcodec VP9 (SW)"
            codec / decoder / colour all present
            nothing under Network at all

Same overlay, same code path in our host — the only difference is which backend the engine dispatched to.

The request

Somewhere on the public surface, for the software path:

  • bytes read (cumulative, from the source reader)
  • throughput, or just the bytes counter if you'd rather we derive the rate ourselves — a monotonic counter is honestly the more useful primitive, since a host can window it however it likes
  • buffer runway in seconds — how far ahead the reader has pulled, distinct from decoded frames queued
  • optionally frames dropped / late, to match droppedFrames

softwareHostFramesEnqueued and segmentCacheDiskBytes are the only two diagnostics exposed today, and neither answers "is the network keeping up".

What we tried first, and why it's wrong

bufferedPosition looks like the answer and isn't. On a healthy VP9 session it reads 20 ms — about one frame at 30 fps — so it is the decoded-frame queue, not network runway. Publishing that under a heading called Network would report a near-stall on a stream that is playing perfectly, so we left the rows blank instead. Blank says "unknown"; 20 ms says something false with confidence.

We also noticed 6.7.0's release note that the software path now reports its read-ahead (#303). If that value already exists internally, this request may be mostly "publish what you already compute" rather than new measurement.

Why it matters to us

The software path is where our exotic content lives — VP9, AV1 without hardware decode, MPEG-4 Part 2 — and it is also where a user is most likely to be near the edge of what their connection or device can sustain. That is exactly when someone opens the stats overlay, and it is currently the one path that can't tell them whether the problem is the network or the decoder. On the native path we can answer that in a glance.

No urgency from our side. Happy to test against a branch, and happy to be told the counters aren't cheap to thread through the reader — in that case a buffer-runway figure alone would still be most of the value.


This issue was auto-generated by Claude on behalf of @kskchaitanya1993.

Activity

  1. added a commit that references this issue on Aug 7, 2026
  2. superuser404notfound commented on Aug 7, 2026

    @superuser404notfound
    Owner

    Shipped in 6.9.0. Thanks for measuring both backends side by side in the same build: that comparison is what separated the two defects behind the blank section, and one of them was not a missing feature.

    The counter was broken, not absent. demuxerBytesFetched resolved through the native HLS session, which a software session does not own, so it returned 0 for the entire session. Everything derived from it went with it: instantBitrateMbps, averageBitrateMbps, networkThroughputMbps, networkTransferredBytes and LiveTelemetry.demuxerBytesFetched. Worth knowing for the overlay: those fields were not nil, they were zero, so a host rendering them showed 0.0 Mbps on a stream playing perfectly rather than a blank. It now reads software first and native second, the precedence the memory probe has always used.

    The read-ahead is published now. Three fields on the 1 Hz snapshot:

    field path meaning
    displayCushionSeconds software decoded video queued past the clock
    readerWindowAheadBytes both fetched but not yet consumed by the demuxer
    accumulatedFrameDelaySeconds software cumulative late-frame delay

    droppedFrameCount is populated on the software path too now, from AVSampleBufferVideoRenderer.videoPerformanceMetrics.

    On bufferedPosition reading 20 ms. That reading was correct, and the decision to leave the rows blank rather than publish it was the right call, but the number is not a defect either. The software demux loop reads on renderer back-pressure, so that path holds a fraction of a second of decoded video by construction. On real hardware a healthy session sits around 0.2 to 0.5 s, and a fresh VP9 run here measured 0.19 to 0.48 s. It is a cushion, not a buffer, which is why it now has a name of its own instead of being folded into forwardBufferSeconds.

    That field stays nil on the software path on purpose. There is no seconds-deep reservoir of arrived-but-unplayed media there to report, and the same magnitude problem would apply to anything published under a name a host reads as the native forward buffer.

    The runway ships in bytes, per the request. readerWindowAheadBytes is the undrained forward extent of the reader window, so it is the quantity that answers "is the network ahead of the demuxer". Seconds would need a bitrate estimate baked into the engine; dividing by the throughput in the same snapshot keeps that choice on the host side.

    Verified against a real VP9 session over a rate-limited logging origin (30 ms latency, 8 Mbps), the numbers now visible on aetherctl play:

    t=02 net=3.28Mbps rx=1.2MB  ahead=0.6MB cushion=0.48s drop=9
    t=08 net=5.73Mbps rx=5.9MB  ahead=4.1MB cushion=0.23s drop=99
    t=14 net=6.63Mbps rx=10.7MB ahead=7.6MB cushion=0.29s drop=190
    

    Every one of those was zero or absent before. The drop count climbs there because the CLI binds no render surface, so it is not a playback verdict; on a bound layer it stays near zero after startup.

    Leaving this open for the retest. The interesting confirmation is whether the Network section now reads sensibly on a session that is genuinely struggling, not only on a healthy one.

  3. added a commit that references this issue on Aug 7, 2026
  4. kskchaitanya1993 commented on Aug 7, 2026

    @kskchaitanya1993
    Author

    Retested on 6.12.0. The Network section populates on the software path, and it degrades the way it should.

    Two runs of the same VP9 source, same build, differing only in the origin.

    Healthy — served from a local file server:

    bytesLoaded 1554493   droppedFrames 0
    downloadBps —         bufferedMs —
    

    Struggling — same file behind a 2 Mbps paced origin with 30 ms latency:

    t= 2   net=1.64 Mbps   rx=1.49 MB   buf=3435 ms   drop=3
    t= 5   net=0.98 Mbps   rx=1.49 MB   buf=1452 ms   drop=3
    t= 7   net=0.14 Mbps   rx=1.49 MB   buf=—         drop=3
    t=10   net=—           rx=1.49 MB   buf=—         drop=3
    

    Every one of those was absent before. The buffer draining 3.4s → 1.4s → nothing as throughput collapses is the shape we wanted out of this section, and it is legible without knowing anything about the engine's internals.

    Why the healthy run still shows blanks, and why I think that is right. Over localhost the fetch is instant, the reader is never behind, and there is genuinely no rate to report — so networkThroughputMbps and readerWindowAheadBytes are zero, not unavailable. That was worth establishing before reading anything into the throttled numbers: it means blanks there are "nothing to measure", not a second defect hiding behind the first. It is also the reason our original report only ever saw an empty section — every fixture we had was local.

    Your note that the counters returned zero rather than nil changed our code. We guard on > 0 rather than on non-nil now, precisely because a host trusting nil-ness would have rendered a confident 0.0 Mbps over a stream playing perfectly. That is a worse failure than a blank, and we would have shipped it — our overlay renders any non-nil number it is given.

    On readerWindowAheadBytes shipping in bytes: the right call for us. We divide by the source bitrate rather than by throughput, because the question our Buffer row asks is "how long will the fetched-but-unconsumed bytes last at playback rate", not "how far ahead is the network right now". Both are derivable from the snapshot; having the raw extent meant we did not have to argue with a baked-in choice.

    On displayCushionSeconds: we are not surfacing it, and your explanation is why. Under a heading called Network a 0.2-0.5s figure reads as a permanent near-stall, whatever it is actually measuring. It is genuinely useful — just not as a buffer, and not in that section. If we surface it later it will be next to the decoder, named as a decode cushion.

    Also carried in this bump, all relevant to live IPTV even though none were ours: bounded reconnects for error-ended zero-byte connections (6.8.0), the pinned redirect target on a metered origin (6.11.0), and noticing a silently dead connection on wall-clock time (6.12.0).

    Regression on our side across the bump: 4K50 HDR HEVC-in-TS held 59s on the native path, a five-channel live zap all staying on Aether, and 28/30 of our fixture matrix rendering a real picture — unchanged from 6.7.0, with the same two non-players (an MP2-audio channel and a deliberate origin 403).

    Happy for this to close.


    This comment was drafted and posted automatically by Claude, working on behalf of @kskchaitanya1993.

  5. added a commit that references this issue on Aug 7, 2026
  6. superuser404notfound commented on Aug 7, 2026

    @superuser404notfound
    Owner

    Thanks for the two-arm retest, and in particular for establishing the healthy baseline before reading anything into the throttled numbers. Reproducing that baseline here turned up one more thing, so it is worth being precise about what the blanks in your healthy run were.

    They were not "nothing to measure". They were a zero, and it was the same kind of zero as the original one. Measured with aetherctl play against a 42 MB / 2.8 Mbps VP9 source over a plain local range origin, on 6.12.0:

    t=01 rx=16.4MB ahead=16.0MB
    t=02 net=0.00Mbps rx=16.4MB ahead=15.5MB cushion=0.44s
    ...
    t=23 net=0.00Mbps rx=16.4MB ahead=8.5MB  cushion=0.42s
    t=25 net=6.92Mbps rx=24.6MB ahead=16.0MB      <- the next refill
    

    23 consecutive ticks of a confident 0.00 Mbps on a session playing perfectly. networkThroughputMbps was a wall-clock mean over a 10 second window, and the reader fetches a large range and then parks on backpressure until low water, so on a fast link most ticks of that window carry no bytes at all. Your > 0 guard is what turned that into a blank on your side. Without it you would have rendered a dead link over a healthy stream, which is exactly the failure the counter defect caused before.

    Fixed on main in 4187b7e (PR #328): the rate is measured over the seconds bytes actually arrived in, and it is nil rather than zero when nothing arrived in the window at all. That makes it the same quantity the native path reports, since observedBitrate in the access log is also the rate observed during a transfer, and the sampler already drops it when it is not positive. Publishing the gap keeps the choice on your side, the same reasoning as shipping the runway in bytes: a host that wants a held reading keeps the last non-nil value, while a host handed a zero cannot tell a parked reader from a dead link.

    Your throttled arm is unchanged, which matters, because that is the arm the section was already legible on. With a 2 Mbps paced origin every tick carries bytes, so both formulas agree:

    t=02 net=2.10Mbps rx=0.6MB ahead=0.0MB cushion=0.00s
    t=30 net=2.10Mbps rx=7.5MB ahead=0.0MB cushion=0.00s
    

    A 2.8 Mbps stream over a 2 Mbps link, with ahead=0 and cushion=0 throughout. That pairing, a link rate below the stream rate with no runway and no cushion, is the starvation signature, and it survives the change intact.

    One note on your own numbers while you are looking at that section again: in your throttled run rx sat at 1.49 MB in all four samples, so no bytes arrived after the first couple of seconds. The buffer draining 3.4s to 1.4s to nothing is that fetch being consumed rather than a link degrading, which for a 1.5 MB fixture is expected. It reads the same either way, but a fixture larger than one reader window is what makes the difference visible.

    Two smaller things from your comment:

    • Dividing the runway by the source bitrate rather than by the throughput is right, and the doc comment saying otherwise was wrong. Dividing by throughput answers how long the runway took to fetch; the divisor for how long it will last is the average bitrate. Corrected in the same commit.
    • displayCushionSeconds next to the decoder rather than under Network is the right home for it, for exactly the reason you give.

    instantBitrateMbps is deliberately left as a wall-clock mean on both paths: that is what makes it the stream rate rather than the link rate.

    Closing this, as you offered. The follow-up ships in the next release, and it needs no change on your side, the > 0 guard is simply no longer load-bearing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions