diff --git a/.gitignore b/.gitignore index e39532a..d95f155 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,15 @@ /test/** .vscode +# Dragon Fork additions: source trees under /core/ and /test/ must be tracked. +!/core/ +!/core/webrtc/ +!/core/webrtc/** +!/test/ +!/test/publish.sh +!/test/whep-client/ +!/test/whep-client/** + *.ts *.ts.tmp *.m3u8 diff --git a/core/webrtc/doc.go b/core/webrtc/doc.go new file mode 100644 index 0000000..396d096 --- /dev/null +++ b/core/webrtc/doc.go @@ -0,0 +1,11 @@ +// Package webrtc implements the Dragon Fork WebRTC egress module. +// +// It exposes a WHEP (WebRTC-HTTP Egress Protocol) HTTP endpoint and serves +// live RTP produced by an FFmpeg process on a local UDP socket to one or +// more WebRTC peer connections built with Pion. +// +// This package is additive: it does not modify existing datarhei ingest, +// transcode, or non-WebRTC output code paths. The only contact with +// existing code is a new URL scheme ("webrtc://") registered with the +// output resolver (done in milestone M2, not here). +package webrtc diff --git a/core/webrtc/errors.go b/core/webrtc/errors.go new file mode 100644 index 0000000..3bf2ae2 --- /dev/null +++ b/core/webrtc/errors.go @@ -0,0 +1,26 @@ +package webrtc + +import "errors" + +// Sentinel errors returned by package functions. +var ( + // ErrStreamNotFound indicates a WHEP subscribe referenced a stream_id + // that has no registered source. Maps to HTTP 404. + ErrStreamNotFound = errors.New("webrtc: stream not found") + + // ErrPeerCapReached indicates max_peers_total has been exceeded. + // Maps to HTTP 503. + ErrPeerCapReached = errors.New("webrtc: peer capacity reached") + + // ErrCodecMismatch indicates the viewer's SDP offer does not include + // a codec the source can serve (expected H.264 + Opus). Maps to HTTP 406. + ErrCodecMismatch = errors.New("webrtc: codec mismatch") + + // ErrInvalidSDP indicates the request body was not a parseable SDP offer. + // Maps to HTTP 400. + ErrInvalidSDP = errors.New("webrtc: invalid SDP") + + // ErrICETimeout indicates ICE gathering did not complete within the + // configured timeout. Maps to HTTP 500. + ErrICETimeout = errors.New("webrtc: ICE gathering timeout") +)