Skip to content

[Feat] MOQ feedback draft support #542

Draft
Sy0307 wants to merge 3 commits intomoq_draft_14_devfrom
moq_draft_14_feedback
Draft

[Feat] MOQ feedback draft support #542
Sy0307 wants to merge 3 commits intomoq_draft_14_devfrom
moq_draft_14_feedback

Conversation

@Sy0307
Copy link
Copy Markdown
Collaborator

@Sy0307 Sy0307 commented Mar 4, 2026

Summary

Implements the complete delivery feedback mechanism defined in draft-moq-delivery-feedback-00 on top of xquic's existing MoQ draft-14 protocol stack. This covers receiver-side delivery status tracking, Feedback Report encoding/decoding, sender-side CC decision-making, and cross-layer control integration at the QUIC CC layer. All logic is built directly as extensions to the moq_transport real protocol stack, reusing the existing session/track/message framework.

Architecture

Receiver (Subscriber)                        Sender (Publisher)
+-----------------------+                    +----------------------------+
| feedback_tracker      | -- fb_report -->   | feedback_track (on_object) |
| (per-object status    |    (encoded &      |   -> fb_report decode      |
|  + LATE/LOST verdict) |     sent via       |   -> fb_input computation  |
+-----------------------+     feedback track  |   -> decision callback     |
| fb_report_gen         |     unidirectional) |      or auto decision      |
| (timer-driven report  |                    |   -> crosslayer gateway    |
|  generation, 100ms)   |                    |      (clamp/rate-limit)    |
+-----------------------+                    |   -> xqc_conn_signal       |
                                             |   -> BBR override          |
                                             +----------------------------+

Changes by Layer

1. Transport / CC Layer Extensions

File Changes
include/xquic/xquic.h Added on_recv_timestamp and x_layer_app_event callbacks to CC interface; added xqc_conn_signal_x_layer_app_event() public API
include/xquic/xquic_typedef.h Defined cross-layer event types (XQC_APP_EVENT_PACING_GAIN_UPDATED, etc.) and payload structs (xqc_pacing_gain_update_t, etc.); all payloads carry expire_time
include/xqc_types.h Defined xqc_crosslayer_event_t as the unified event interface for the crosslayer gateway
src/transport/xqc_conn.c Implemented xqc_conn_signal_x_layer_app_event() to dispatch cross-layer events to the CC algorithm
src/transport/xqc_frame.c ACK_EXTENDED frame extension support
src/transport/xqc_send_ctl.c/.h Receive timestamp callback integration
src/congestion_control/xqc_bbr.c/.h Added MoQ override mechanism to BBR (pacing_gain / pacing_rate / target_bitrate — three override types with automatic expiry recovery); added on_recv_timestamp callback for OWD recording
src/cc/xqc_crosslayer.c/.h Cross-layer control gateway: unified entry point with rate-limiting (50ms), gain clamping [0.5, 2.0], dispatch counting, and logging

2. QUIC Receive Timestamps

File Changes
src/recv_ts/xqc_recv_ts.c/.h Implemented draft-ietf-quic-receive-ts per-packet receive timestamp ring buffer with delta encoding/decoding
include/xquic/xqc_configure.h Compile-time feature flag

3. MoQ Feedback Report Codec

File Changes
include/moq/xqc_moq_fb_report.h Defined xqc_moq_fb_report_t, xqc_moq_fb_object_row_t, xqc_moq_fb_summary_stats_t, xqc_moq_fb_optional_metric_t, strictly aligned with draft Section 5 format
moq/moq_transport/xqc_moq_fb_report.c Implemented encode/decode/free using ZigZag + QUIC varint encoding for signed deltas
src/common/xqc_varint.c/.h QUIC varint encoding/decoding utilities

4. Receiver: Delivery Tracking + Report Generation

File Changes
moq/moq_transport/xqc_moq_feedback_tracker.c/.h Ring buffer tracker recording per-object status (RECEIVED / RECEIVED_LATE / NOT_RECEIVED). LATE verdict uses gap-based interval detection (avoids timeline drift). Tail loss timeout detection (2× expected_interval). Summary stats computed per-period (current report cycle only)
moq/moq_transport/xqc_moq_fb_report_gen.c/.h 100ms timer-driven: exports object rows + summary from tracker, encodes into fb_report, and sends via feedback track unidirectional stream
moq/moq_transport/xqc_moq_message_handler.c Calls fb_report_gen_on_media_object_received() to update tracker upon receiving a media Object

5. Sender: Feedback Consumption + CC Decision

File Changes
moq/moq_transport/xqc_moq_feedback_track.c/.h Feedback track ops: decode report → compute fb_input (loss_rate, late_rate, playout_ahead, estimated_bw) → trigger observer callback → user decision callback (Level 2.5) → auto decision fallback → crosslayer dispatch
moq/moq_transport/xqc_moq_feedback_decision.c/.h Pure policy layer: 7 priority rules (severe loss → critical playout → heavy loss/late → mild loss/late → BW hint → recovery probe-up), with configurable thresholds

6. Session / Track Extensions

File Changes
include/moq/xqc_moq.h Added public APIs: feedback decision types, 3-level control configuration APIs, crosslayer bounds API, diagnostic getter APIs; added on_delivery_feedback / on_feedback_decision callbacks
moq/moq_transport/xqc_moq_session.c/.h Session initialization of crosslayer gateway, negotiation of DELIVERY_FEEDBACK parameter (0xA2, bitmap 0x07), feedback state management
moq/moq_transport/xqc_moq_track.c/.h Track: added feedback_tracker pointer and target_latency_us field
moq/CMakeLists.txt Added all feedback source files

7. Demo + E2E Tests

File Changes
moq/demo/xqc_moq_feedback_client.c Demo client: subscribes to video track + sets target_latency + creates feedback track to send reports
moq/demo/xqc_moq_feedback_server.c Demo server: publishes video track + subscribes to feedback track + callback logging + commented example code (Level 0/1/2 usage patterns)
scripts/moq_scripts/moq_feedback_test.sh 18 E2E test cases using Linux tc for network impairment injection, all passed

E2E Test Cases (18/18 passed)

# Case Draft Section Coverage
1 clean_network S4 (Setup), S5 (Report)
2 network_loss S5.3 (NOT_RECEIVED)
3 jitter_tolerance S5.4 (avg_inter_arrival_delta)
4 negotiation S4 (0xA2 parameter)
5 network_delay S5.4 (Summary Stats)
6 heavy_loss (40%) S5.3, S10.1 (best-effort)
7 feedback_loss S10.1 (report seq gap)
8 summary_accuracy S5.4.2 (total == recv + lost)
9 playout_metric S5.5 (PLAYOUT_AHEAD_MS)
10 loss_recovery S7.2 (status update)
11 late_via_delay S5.3 (RECEIVED_LATE)
12 report_seq S5.1 (monotonic sequence)
13 object_entries S5.2 (object_id strict ascending)
14 report_freq S7.3 (50ms - 2s interval)
15 cc_integration S8.4 (crosslayer → BBR override)
16 override_expiry BBR override auto-expire
17 cubic_no_handler cc_dispatch==0 for CC without handler
18 cc_recovery_probeup last_gain > 1.0 after recovery

Feedback Control API (3 Levels)

Level Code Required Description
0 (Default) Zero code Built-in auto decision + default thresholds
1 (Custom thresholds) 1 line set_feedback_decision_config() to tune thresholds
2 (Decision callback) 1 callback on_feedback_decision for fully custom policy; return XQC_OK = decision made (including explicit NONE no-op); return non-OK = fall back to auto

Sy0307 added 3 commits March 4, 2026 15:24
…Q, including new types and structures for feedback reports, and integrate feedback decision logic into the session management.
…feedback reporting with new structures for track-level quality and connection stats.
… clients to send upload tracks and servers to subscribe, enhancing media quality reporting and network statistics collection.
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.

1 participant