fix(moqt): TrackReader が subgroup stream を並行に読むようにする - #355
Merged
Conversation
accept_publish and the data-receiver helper move from the TrackWriter tests to modules/test_support.rs so the TrackReader tests can publish over the same in-process DUAL session.
…Reader TrackReader read one subgroup stream until FIN before taking the next stream from the factory. MoQT delivers subgroups on independent uni streams that overlap in time, so a publisher that opens the next group before closing the previous one (the browser wasm client only closes a stream when it sends EndOfGroup), or that uses several subgroups per group, stalled the reader after the first stream while later objects sat in the factory's channel. The reader now runs an accept task that spawns one reader task per subgroup stream; readers feed a bounded channel so a slow consumer applies QUIC flow control to the publisher. Objects are yielded in arrival order, ordered only within a subgroup as the draft guarantees, and TrackObject gains the resolved subgroup_id so consumers can order across subgroups themselves. A failure in one stream is reported as Err while the other streams keep being read.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
TrackReaderは現在の subgroup stream が FIN するまで次の stream を読まず、前の stream を閉じずに次の group を開く publisher(ブラウザの wasm クライアント)や 1 group に複数 subgroup を使う publisher に対して、最初の stream 以降を読めなくなっていました。全 stream を並行に読む実装に直しました。
やったこと
next_object()に渡す(消費側の遅れは QUIC フロー制御として publisher に伝わる)TrackObjectにsubgroup_id(field なし → 0、FirstObjectIdDelta 型 → 最初の object id)を追加。1 stream の失敗はErrとして返し、他の stream は読み続けるtest_support.rsに共通化し、「前の stream を閉じずに次の group を開く」「同一 group の 2 subgroup」「FirstObjectIdDelta の解決」「status object の読み飛ばしと stream close 後の継続」の 4 テストを追加やらないこと
subgroup_idの公開は当該 PR で行う影響範囲
TrackObjectにフィールドが増える(struct literal で組んでいる箇所はワークスペース内にない)。TrackReader::newはタスクを spawn するため tokio runtime 上で呼ぶ必要があるテスト
cargo test -p moqt -p relay全通過(新テストは 5 回連続で安定)。cargo clippy --workspace --all-targets --all-features -- -D warnings/cargo fmt --all -- --check警告なしsubgroup_idがなくコンパイル不可)