feat(stream): expose upstream metadata headers#684
Conversation
Documentation previewThe documentation preview has been deployed for this pull request. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 620d21eb22
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (metadata && !metadata->frozen && rtsp_sdp_describes_mp2t_rtp(sdp_body)) { | ||
| metadata->upstream_payload = STREAM_PAYLOAD_MP2T_RTP; |
There was a problem hiding this comment.
Scope SDP payload detection to selected media track
When a DESCRIBE SDP has multiple m= sections and a later track advertises MP2T, this sets R2H-Upstream-Payload even though the code immediately below chooses the first media-level a=control for SETUP. For streams whose first track is H264/audio/etc. and a later track is MP2T, HEAD responses and early stream headers can incorrectly report mp2t-rtp for the proxied track; the payload probe should be limited to the same media section selected for SETUP.
Useful? React with 👍 / 👎.
| if (metadata->fcc_type != STREAM_FCC_TYPE_UNKNOWN && metadata->fcc_status == STREAM_FCC_STATUS_UNKNOWN) { | ||
| if (origin == STREAM_MEDIA_ORIGIN_FCC_UNICAST) { | ||
| metadata->fcc_status = STREAM_FCC_STATUS_ACTIVE; |
There was a problem hiding this comment.
Defer FCC status until media is actually output
When an FCC unicast packet is merely received, this marks status active before stream_process_rtp_payload and the reorder buffer have actually delivered any bytes to the client. If those unicast packets are still buffered or discarded and multicast supplies the first bytes that trigger the HTTP headers, for example after fallback during the reorderer's initial collection, the response will still say R2H-FCC-Status: active instead of fallback; defer the status choice until the origin that actually queues the first media.
Useful? React with 👍 / 👎.
Summary
R2H-*upstream metadata headers for RTSP, multicast, FCC, MPEG-TS, and JPEG snapshot responsesMotivation
Downstream HTTP clients need a consistent way to understand how a stream was sourced and negotiated without exposing sensitive upstream RTSP details or requiring a media parser. HEAD requests should provide all metadata available from static configuration or SDP without creating a media stream.
Implementation notes
Metadata is stored in a fixed-size
stream_metadata_tand frozen when response headers are emitted. Unknown or unconfirmed values are omitted. RTSP HEAD probes stop after DESCRIBE and synchronously release the control connection before queuing the HTTP response, preventing later upstream hangups from dropping the response. The implementation intentionally does not expose FEC state orR2H-Metadata-Version.Validation