From 1d4dc86135e67293f55e0e1e7bc7f2e696f02ae3 Mon Sep 17 00:00:00 2001 From: exel Date: Fri, 5 Apr 2019 17:58:08 +0800 Subject: [PATCH] remove sleep --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index ed71c53c..6758d16a 100644 --- a/main.go +++ b/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) } }