Skip to content

avformat/whep: add SDP offer/answer generation for WHEP demuxer - #81

Open
Nariman-Sayed wants to merge 4 commits into
whep_prefrom
whep-implementation
Open

avformat/whep: add SDP offer/answer generation for WHEP demuxer#81
Nariman-Sayed wants to merge 4 commits into
whep_prefrom
whep-implementation

Conversation

@Nariman-Sayed

Copy link
Copy Markdown
Collaborator

Add certificate_key_init(), initialize(), generate_sdp_offer(), exchange_sdp() and parse_answer(), covering the offer/answer phase of the WHEP (WebRTC-HTTP Egress Protocol) demuxer.

Uses the shared RTCContext for ICE state (ufrag/pwd, remote candidate), matching the current whip.c layout.

Not yet included: whep_init() entry point, FFInputFormat registration, ICE/DTLS/SRTP, RTP receive. These are deferred to follow-up commits.

Add certificate_key_init(), initialize(), generate_sdp_offer(),
exchange_sdp() and parse_answer(), covering the offer/answer phase
of the WHEP (WebRTC-HTTP Egress Protocol) demuxer.

Uses the shared RTCContext for ICE state (ufrag/pwd, remote
candidate), matching the current whip.c layout.

Not yet included: whep_init() entry point, FFInputFormat
registration, ICE/DTLS/SRTP, RTP receive. These are deferred to
follow-up commits.

Signed-off-by: Nariman Sayed <narimansayed28@gmail.com>
Chain the existing offer/answer functions into whep_init(), and
register the WHEP demuxer (ff_whep_demuxer) in allformats.c,
Makefile, and configure.

read_packet() is a stub (AVERROR(ENOSYS)). RTP receive is deferred
to a follow-up commit.

Tested end-to-end against a real SRS server: offer/answer exchange,
ICE candidate parsing, and DTLS fingerprint validation all succeed
(WHEP_STATE_NEGOTIATED reached). Stream creation fails as expected
since read_packet is not yet implemented.

Signed-off-by: Nariman Sayed <narimansayed28@gmail.com>
Open the UDP transport to the remote ICE candidate parsed from the
SDP answer, chained into whep_init() after parse_answer().

Tested against a real SRS server: UDP socket connects successfully
to the negotiated candidate address.

Signed-off-by: Nariman Sayed <narimansayed28@gmail.com>
Add STUN binding request/response handling and DTLS handshake
initiation for WHEP, adapted from whip.c's implementation.

is_dtls_active is hardcoded to active for now rather than parsed
from the peer's a=setup: line in the SDP answer. SRS always answers
with a=setup:passive, so this is correct against it, but reading
the real a=setup: value is a follow-up improvement.

Tested end-to-end against a real SRS server: ICE STUN completes,
DTLS handshake finishes successfully.

Signed-off-by: Nariman Sayed <narimansayed28@gmail.com>
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