add legacy simulcast stream that shows pointer.

This commit is contained in:
Miroslav Šedivý 2024-09-07 21:13:40 +02:00
parent b3b31fba1f
commit 373e9970f9
5 changed files with 48 additions and 2 deletions

View file

@ -1,8 +1,27 @@
capture:
video:
codec: vp8
# legacy format is not added to the list of ids so that its ignored by bandwidth estimator
ids: [ hq, lq ]
pipelines:
# legacy format is the same as hq, but with show_pointer enabled
legacy:
fps: 25
gst_encoder: vp8enc
gst_params:
target-bitrate: round(3072 * 650)
cpu-used: 4
end-usage: cbr
threads: 4
deadline: 1
undershoot: 95
buffer-size: (3072 * 4)
buffer-initial-size: (3072 * 2)
buffer-optimal-size: (3072 * 3)
keyframe-max-dist: 25
min-quantizer: 4
max-quantizer: 20
show_pointer: true
hq:
fps: 25
gst_encoder: vp8enc

View file

@ -49,8 +49,8 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
}
return fmt.Sprintf(
"ximagesrc display-name=%s show-pointer=false use-damage=false "+
"%s ! appsink name=appsink", config.Display, pipeline,
"ximagesrc display-name=%s show-pointer=%v use-damage=false "+
"%s ! appsink name=appsink", config.Display, pipelineConf.ShowPointer, pipeline,
), nil
}

View file

@ -359,9 +359,17 @@ func (s *Capture) Set() {
"min-quantizer": "4",
"max-quantizer": "20",
},
ShowPointer: viper.GetBool("legacy"),
},
}
s.VideoIDs = []string{"main"}
if viper.GetBool("legacy") {
legacyPipeline := s.VideoPipelines["main"]
legacyPipeline.ShowPointer = true
s.VideoPipelines["legacy"] = legacyPipeline
// we do not add legacy to VideoIDs so that its ignored by bandwidth estimator
}
}
// audio
@ -463,7 +471,13 @@ func (s *Capture) SetV2() {
"main": {
GstPipeline: pipeline,
},
"legacy": {
GstPipeline: pipeline,
ShowPointer: true,
},
}
// we do not add legacy to VideoIDs so that its ignored by bandwidth estimator
s.VideoIDs = []string{"main"}
// TODO: add deprecated warning and proper alternative
}
}

View file

@ -60,6 +60,18 @@ func (s *session) wsToBackend(msg []byte) error {
s.name = request.DisplayName
}
// try to set legacy video stream, if it fails, it will be ignored
if err := s.toBackend(event.SIGNAL_VIDEO, &message.SignalVideo{
PeerVideoRequest: types.PeerVideoRequest{
Selector: &types.StreamSelector{
Type: types.StreamSelectorTypeExact,
ID: "legacy",
},
},
}); err != nil {
return err
}
return s.toBackend(event.SIGNAL_ANSWER, &message.SignalDescription{
SDP: request.SDP,
})

View file

@ -158,6 +158,7 @@ type VideoConfig struct {
GstParams map[string]string `mapstructure:"gst_params"` // map of expressions
GstSuffix string `mapstructure:"gst_suffix"` // pipeline suffix, starts with !
GstPipeline string `mapstructure:"gst_pipeline"` // whole pipeline as a string
ShowPointer bool `mapstructure:"show_pointer"` // show pointer in the video
}
func (config *VideoConfig) GetPipeline(screen ScreenSize) (string, error) {