mirror of
https://github.com/livekit/livekit.git
synced 2026-05-24 21:15:36 +00:00
Add basic video support to WHIP. (#3602)
Tested with eyevinn client. There are a few issues to figure out still 1. Simulcast - how? 2. For simulcast, how to know width, height so that adaptive stream can work. 3. The layer added is dummy. It works, but connection quality scoring would be incorrect (will always say excellent) without bitrate. Will need some dynamic update of `TrackInfo` based on actual stream for all of this to fit well into our system, but the simple video support works for now.
This commit is contained in:
+23
-5
@@ -858,8 +858,7 @@ func (p *ParticipantImpl) synthesizeAddTrackRequests(offer webrtc.SessionDescrip
|
||||
}
|
||||
|
||||
for _, m := range parsed.MediaDescriptions {
|
||||
if !strings.EqualFold(m.MediaName.Media, "audio") {
|
||||
// ONE-SHOT-SIGNALLING-MODE-TODO: support video
|
||||
if !strings.EqualFold(m.MediaName.Media, "audio") && !strings.EqualFold(m.MediaName.Media, "video") {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -886,15 +885,34 @@ func (p *ParticipantImpl) synthesizeAddTrackRequests(offer webrtc.SessionDescrip
|
||||
trackID = guid.New(utils.TrackPrefix)
|
||||
}
|
||||
|
||||
var (
|
||||
name string
|
||||
trackSource livekit.TrackSource
|
||||
trackType livekit.TrackType
|
||||
)
|
||||
if strings.EqualFold(m.MediaName.Media, "audio") {
|
||||
name = "synthesized-microphone"
|
||||
trackSource = livekit.TrackSource_MICROPHONE
|
||||
trackType = livekit.TrackType_AUDIO
|
||||
} else {
|
||||
name = "synthesized-camera"
|
||||
trackSource = livekit.TrackSource_CAMERA
|
||||
trackType = livekit.TrackType_VIDEO
|
||||
}
|
||||
req := &livekit.AddTrackRequest{
|
||||
Cid: trackID,
|
||||
Name: "synthesized-microphone",
|
||||
Source: livekit.TrackSource_MICROPHONE,
|
||||
Type: livekit.TrackType_AUDIO,
|
||||
Name: name,
|
||||
Source: trackSource,
|
||||
Type: trackType,
|
||||
DisableDtx: true,
|
||||
Stereo: false,
|
||||
Stream: "camera",
|
||||
}
|
||||
// ONE-SHOT-SIGNALLING-MODE-TODO: support video simulcast
|
||||
if strings.EqualFold(m.MediaName.Media, "video") {
|
||||
// dummy layer to ensure at least one layer is available
|
||||
req.Layers = []*livekit.VideoLayer{{}}
|
||||
}
|
||||
p.AddTrack(req)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user