mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 08:21:50 -06:00
fix(capture): derive video ids from pipelines and guard empty list (#711)
when NEKO_CAPTURE_VIDEO_PIPELINES is set without capture.video.ids the VideoIDs list stayed empty, so capture.Video().IDs() returned [] and the first websocket signal request crashed the whole server with "index out of range [0] with length 0" in signalRequest. now we fill VideoIDs from the configured pipeline keys (sorted by id) whenever no ids are set explicitly, and signalRequest returns a plain error instead of panicking when there is no video stream at all. added tests for the config loader, the capture manager and the signal handler so this path stays covered.
This commit is contained in:
committed by
GitHub
parent
bdd0428a60
commit
a2cb38dd10
@@ -30,6 +30,9 @@ func (h *MessageHandlerCtx) signalRequest(session types.Session, payload *messag
|
||||
// use default first video, if not provided
|
||||
if video.Selector == nil {
|
||||
videos := h.capture.Video().IDs()
|
||||
if len(videos) == 0 {
|
||||
return errors.New("no video streams available")
|
||||
}
|
||||
video.Selector = &types.StreamSelector{
|
||||
ID: videos[0],
|
||||
Type: types.StreamSelectorTypeExact,
|
||||
|
||||
Reference in New Issue
Block a user