From c22c399f409509c940f2fb00693180ed52b53f38 Mon Sep 17 00:00:00 2001 From: Sense T Date: Fri, 30 Sep 2022 05:46:58 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=81=9C=EF=BC=8C=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO | 3 +++ lib/webrtcconnection/connection.go | 6 +++++- servers/qemuserver/server.go | 1 + web/src/components/AceScreen.vue | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 072621e..7fc516c 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,6 @@ 3. 整体重构! 4. 综合调试 +# 2022-9-30 +1. 视频没有图像 +2. qemu只在声卡初始化后才开始抓取声音 \ No newline at end of file diff --git a/lib/webrtcconnection/connection.go b/lib/webrtcconnection/connection.go index d9c78b1..d2494ec 100644 --- a/lib/webrtcconnection/connection.go +++ b/lib/webrtcconnection/connection.go @@ -61,7 +61,7 @@ func New(o *Options) (*Connection, error) { } func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDescription, error) { - logrus.Debug("received offer ", offer) + logrus.Debug("received offer ") rtc, err := c.api.NewPeerConnection(webrtc.Configuration{ ICEServers: []webrtc.ICEServer{ @@ -78,6 +78,10 @@ func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDe logrus.Debug("connection state has changed: ", connectionState.String()) }) + rtc.OnICECandidate(func(i *webrtc.ICECandidate) { + logrus.Debug("cadidate: ", i) + }) + for _, track := range c.stream.GetTracks() { track.OnEnded(func(err error) { logrus.Errorf("Track (ID: %s, kind: %s) ended with error: %v", track.ID(), track.Kind().String(), err) diff --git a/servers/qemuserver/server.go b/servers/qemuserver/server.go index f433b60..f3c9219 100644 --- a/servers/qemuserver/server.go +++ b/servers/qemuserver/server.go @@ -130,6 +130,7 @@ func (s *Server) Run() error { logrus.Fatal(err) } + logrus.Debug("start reading PCM") defer close(s.pcm) for { b := make([]byte, 2048) // to be configured diff --git a/web/src/components/AceScreen.vue b/web/src/components/AceScreen.vue index 446e64a..69e8b59 100644 --- a/web/src/components/AceScreen.vue +++ b/web/src/components/AceScreen.vue @@ -101,7 +101,7 @@ onMounted(() => { el.oncontextmenu = () => false; document.getElementById("data").appendChild(el); - if (el.track.kind === "video") { + if (ev.track.kind === "video") { const ctx = video.getContext("2d"); setTimeout(() => { ctx.drawImage(this.video, 0, 0);