Commit 6f5ae12f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Move RTP-specific code into its own package.

parent 98245cbd
// Copyright (c) 2020 by Juliusz Chroboczek. package rtpconn
// This is not open source software. Copy it, and I'll break into your
// house and tell your three year-old that Santa doesn't exist.
package main
import ( import (
"errors" "errors"
......
package main package rtpconn
import ( import (
"sort" "sort"
......
package main package rtpconn
import ( import (
"errors" "errors"
......
// Copyright (c) 2020 by Juliusz Chroboczek. package rtpconn
// This is not open source software. Copy it, and I'll break into your
// house and tell your three year-old that Santa doesn't exist.
package main
import ( import (
"encoding/json" "encoding/json"
...@@ -580,7 +575,7 @@ func (c *webClient) PushConn(id string, up conn.Up, tracks []conn.UpTrack, label ...@@ -580,7 +575,7 @@ func (c *webClient) PushConn(id string, up conn.Up, tracks []conn.UpTrack, label
return nil return nil
} }
func startClient(conn *websocket.Conn) (err error) { func StartClient(conn *websocket.Conn) (err error) {
var m clientMessage var m clientMessage
err = conn.SetReadDeadline(time.Now().Add(15 * time.Second)) err = conn.SetReadDeadline(time.Now().Add(15 * time.Second))
......
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
"sfu/disk" "sfu/disk"
"sfu/group" "sfu/group"
"sfu/rtpconn"
"sfu/stats" "sfu/stats"
) )
...@@ -306,7 +307,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) { ...@@ -306,7 +307,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
go func() { go func() {
err := startClient(conn) err := rtpconn.StartClient(conn)
if err != nil { if err != nil {
log.Printf("client: %v", err) log.Printf("client: %v", err)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment