mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-23 22:17:07 +02:00
default screen size
This commit is contained in:
parent
e9cf941870
commit
4fe1d481a0
2 changed files with 44 additions and 1 deletions
|
@ -56,6 +56,14 @@ type WebRTCManager struct {
|
|||
func (m *WebRTCManager) Start() {
|
||||
xorg.Display(m.config.Display)
|
||||
|
||||
if !xorg.ValidScreenSize(m.config.ScreenWidth, m.config.ScreenHeight, m.config.ScreenRate) {
|
||||
m.logger.Warn().Msgf("invalid screen option %dx%d@%d", m.config.ScreenWidth, m.config.ScreenHeight, m.config.ScreenRate)
|
||||
} else {
|
||||
if err := xorg.ChangeScreenSize(m.config.ScreenWidth, m.config.ScreenHeight, m.config.ScreenRate); err != nil {
|
||||
m.logger.Warn().Err(err).Msg("unable to change screen size")
|
||||
}
|
||||
}
|
||||
|
||||
videoPipeline, err := gst.CreatePipeline(
|
||||
m.config.VideoCodec,
|
||||
m.config.Display,
|
||||
|
@ -231,7 +239,15 @@ func (m *WebRTCManager) CreatePeer(id string, sdp string) (string, types.Peer, e
|
|||
}
|
||||
|
||||
func (m *WebRTCManager) ChangeScreenSize(width int, height int, rate int) error {
|
||||
if !xorg.ValidScreenSize(width, height, rate) {
|
||||
return fmt.Errorf("unknown configuration")
|
||||
}
|
||||
|
||||
m.videoPipeline.Stop()
|
||||
defer func() {
|
||||
m.videoPipeline.Start()
|
||||
m.logger.Info().Msg("starting pipeline")
|
||||
}()
|
||||
|
||||
if err := xorg.ChangeScreenSize(width, height, rate); err != nil {
|
||||
return err
|
||||
|
@ -248,7 +264,6 @@ func (m *WebRTCManager) ChangeScreenSize(width int, height int, rate int) error
|
|||
}
|
||||
|
||||
m.videoPipeline = videoPipeline
|
||||
m.videoPipeline.Start()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue