暂停,需要解决一些问题

This commit is contained in:
Sense T 2022-09-30 05:46:58 +00:00
parent dc9b5ce0b1
commit c22c399f40
4 changed files with 10 additions and 2 deletions

3
TODO
View File

@ -4,3 +4,6 @@
3. 整体重构! 3. 整体重构!
4. 综合调试 4. 综合调试
# 2022-9-30
1. 视频没有图像
2. qemu只在声卡初始化后才开始抓取声音

View File

@ -61,7 +61,7 @@ func New(o *Options) (*Connection, error) {
} }
func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDescription, 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{ rtc, err := c.api.NewPeerConnection(webrtc.Configuration{
ICEServers: []webrtc.ICEServer{ ICEServers: []webrtc.ICEServer{
@ -78,6 +78,10 @@ func (c *Connection) Regist(offer *webrtc.SessionDescription) (*webrtc.SessionDe
logrus.Debug("connection state has changed: ", connectionState.String()) logrus.Debug("connection state has changed: ", connectionState.String())
}) })
rtc.OnICECandidate(func(i *webrtc.ICECandidate) {
logrus.Debug("cadidate: ", i)
})
for _, track := range c.stream.GetTracks() { for _, track := range c.stream.GetTracks() {
track.OnEnded(func(err error) { track.OnEnded(func(err error) {
logrus.Errorf("Track (ID: %s, kind: %s) ended with error: %v", track.ID(), track.Kind().String(), err) logrus.Errorf("Track (ID: %s, kind: %s) ended with error: %v", track.ID(), track.Kind().String(), err)

View File

@ -130,6 +130,7 @@ func (s *Server) Run() error {
logrus.Fatal(err) logrus.Fatal(err)
} }
logrus.Debug("start reading PCM")
defer close(s.pcm) defer close(s.pcm)
for { for {
b := make([]byte, 2048) // to be configured b := make([]byte, 2048) // to be configured

View File

@ -101,7 +101,7 @@ onMounted(() => {
el.oncontextmenu = () => false; el.oncontextmenu = () => false;
document.getElementById("data").appendChild(el); document.getElementById("data").appendChild(el);
if (el.track.kind === "video") { if (ev.track.kind === "video") {
const ctx = video.getContext("2d"); const ctx = video.getContext("2d");
setTimeout(() => { setTimeout(() => {
ctx.drawImage(this.video, 0, 0); ctx.drawImage(this.video, 0, 0);