mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-07-17 16:50:31 +00:00
remove sleep
This commit is contained in:
parent
6599658734
commit
1d4dc86135
1 changed files with 4 additions and 4 deletions
8
main.go
8
main.go
|
|
@ -6,7 +6,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
// "time"
|
||||
|
||||
"github.com/giongto35/game-online/ui"
|
||||
"github.com/giongto35/game-online/util"
|
||||
|
|
@ -18,7 +18,7 @@ import (
|
|||
var width = 256
|
||||
var height = 240
|
||||
var gameName = "supermariobros.rom"
|
||||
var FPS = 60
|
||||
// var FPS = 60
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ func postSession(w http.ResponseWriter, r *http.Request) {
|
|||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
imageChannel := make(chan *image.RGBA, FPS)
|
||||
imageChannel := make(chan *image.RGBA, 100)
|
||||
go screenshotLoop(imageChannel, webRTC)
|
||||
go startGame("games/" + gameName, imageChannel, webRTC.InputChannel, webRTC)
|
||||
|
||||
|
|
@ -89,6 +89,6 @@ func screenshotLoop(imageChannel chan *image.RGBA, webRTC *webrtc.WebRTC) {
|
|||
webRTC.ImageChannel <- yuv
|
||||
}
|
||||
// time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(time.Duration(1000 / FPS) * time.Millisecond)
|
||||
// time.Sleep(time.Duration(1000 / FPS) * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue