Skip to content

V3 engine: encode stream sizes default to zero, making "not reported" indistinguishable from "zero bytes" #88

Description

@Loufe

Line references at rewrite b58160b. Minor, in the spirit of #86.

What happens

encode accumulates stream sizes into a local seeded with StreamSizes::default():

  • ab_av1/operation.rs:162let mut sizes = StreamSizes::default();
  • ab_av1/operation.rs:182-184Update::StreamSizes { .. } overwrites it.
  • ab_av1/operation.rs:185-192Update::Done { .. } returns immediately with stream_sizes: sizes.

StreamSizes is four plain u64s (ab_av1/types.rs:69-74), so the default is all zeros and carries no "unset" state.

Two ways that reads wrong:

  1. If StreamSizes is never emitted, we report a successful encode with zero video, audio, subtitle and other bytes. A successful video encode never legitimately has zero video bytes, so this is a silent data-quality failure rather than an error. Upstream derives these by parsing ffmpeg's summary line, so a parse miss or an ffmpeg output change produces it.

  2. If StreamSizes arrived after Done it would be dropped, because the Done arm returns rather than breaking. The ordering happens to hold in the pinned fork (sizes are yielded inside the progress loop, Done after it), but nothing across the boundary enforces it, and the failure is silent rather than loud.

Where the zeros go

coordinator/output_flow.rs:285-289 copies them field-for-field into StreamByteSizes, which reaches state.rs:82, projection.rs:997 and estimation.rs:387. So a missing report becomes persisted history that later feeds estimation.

Direction

Make the absence representable rather than defaulted: accumulate Option<StreamSizes> and decide explicitly at Done whether "no sizes reported" is an error, a warning, or a legitimately empty result. Same principle as the reject/deltas item in #86, that a state which should be impossible is better made unrepresentable than left to call-site ordering.

Not observed in the wild; found by reading the adapter while auditing the ab-av1 boundary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions