moq-mux: FLV export writes PTS as the tag timestamp with composition time 0 (non-monotonic DTS on moq-rtmp play)
## Summary
`flv::Export` (`rs/moq-mux/src/container/flv/export.rs`) writes `frame.timestamp.as_millis()` (a PTS) into the FLV tag timestamp and always writes `[0, 0, 0]` for the 3-byte composition-time field, for both legacy AVC and hvc1 (the comment at ~line 376 says "zero, since we carry PTS in the tag").
FLV tag timestamps are the DTS and must be monotonic. Frames arrive in decode order, so a B-frame H.264/HEVC broadcast played out through moq-rtmp produces non-monotonic tag timestamps with DTS == PTS.
## Impact
- ffmpeg / nginx-rtmp / players log "non-monotonous DTS" and clamp or drop frames; B-frame reorder stutter on the play path.
- Each backward step also hits rml_rtmp's wrapping chunk-timestamp delta (its serializer has a literal `// TODO: Update to support rtmp time wrap-around`), encoding a ~2^32 extended-timestamp delta that only decodes correctly on clients doing exact mod-2^32 accumulation.
The import side is asymmetric and correct: `flv/import.rs` computes PTS = DTS + cts on the way in.
## Suggested fix
Author DTS for the tag timestamp (same `author_dts` approach the TS exporter uses) and emit the real signed cts in the composition-time field for AVC/HEVC.
Found during a full review of the dev branch; verified present on main as well.
(Written by Claude Fable 5)
1 条评论